1
votes

I have overrided woocommerce variable.php template by putting my file here

wp-content/themes/shopper/woocommerce/single-product/add-to-cart/variable.php

This is how I interpreted the instructions in : https://docs.woocommerce.com/document/template-structure/

I have modified variable.php in various ways but no change is shown when accessing a product page. However, I tried creating a child theme as Shopper-child and placed files accordingly as:

wp-content/themes/shopper-child/woocommerce/single-product/add-to-cart/

It worked on the file variation-add-to-cart-button.php when I modified it, but modifying variable.php has no effect..

Also, creating and using a child theme causes the layout to look like the standard woocommerce although I did not add any css changes for the child.

I have checked wc-status and under template overrides it shows shopper-child/woocommerce/single-product/add-to-cart/variable.php.

I'm not developing for the Shopper theme, I'd just want to change which variations are shown. I found instructions here https://github.com/woocommerce/woocommerce/wiki/Declaring-WooCommerce-support-in-themes, that a theme developer should declare support for woocommerce in the theme's function.php file. I saw that the theme developer has not added support for woocommerce, and I also tried to put it there myself but it had no effect.

I have tried adding define('WC_TEMPLATE_DEBUG_MODE', false); to wp_config.php as mentioned here Overriding Woocommerce child theme not working but that didn't have any effect either.

I don't really know what I could still try except modifying woocommerce's variable.php file directly. But then I have to do it every time I update woocommerce. Could it be that the Shopper theme is somehow preventing me from overriding?

1
I am stuck on the same problem. Did you managed to do it?Matan Gubkin

1 Answers

0
votes

Your theme might be not using the woocommerce_variable_add_to_cart hook.

You can try searching the theme files for woocommerce_variable_add_to_cart and see if it has the action removed or changed. Because that's the function calling the template 'single-product/add-to-cart/variable.php'