How to properly modify 2 lines of another plugins

I am coding some permalinks rewrite for WooCommerce awesome plugin.
Everything is well packed in a plugin and work well… except for one thing.

WooCommerce use get_term_link() to display HTML link in default template. A lot of custom templates use it too. If I want to display the good link on my website, I must change one line of code in woocommerce plugin. This is dirty, since basic user would not do it. Since I want to list it on WordPress plugin repertory, I would like some help here…

Read More

What I need to do :

Open woocommerce.php and replace line 767 :

OLD 
$product_category_slug  = empty( $permalinks['category_base'] ) ? _x( 'product-category', 'slug', 'woocommerce' ) : $permalinks['category_base'];

NEW
$product_category_slug  = '';

Very easy to do by editing the file, but it is dirty. It is non user friendly, and it depends a lot of woocommerce next version… So my question here: how can I do it from my own plugin, without asking people to open their woocommerce plugin with Notepad++… Is there any way ?

I hope you understand my need and could provide me with an answer 🙂

Related posts

Leave a Reply

1 comment