Hi Peter,
Try to switch to default theme (e.g. Storefront) and deactivate all plugins except WC and UniCPO and then check this issue. Seems it is compatibility issue.
Thread Starter
jazura
(@jazura)
Thanks. After trying out lots of things, it seems the culprit is not really another plugin or theme. It’s an extra code snippet in the functions.php :
add_action( 'woocommerce_after_shop_loop_item', 'my_woocommerce_template_loop_add_to_cart', 10 );
function my_woocommerce_template_loop_add_to_cart() {
echo '<form action="' . get_permalink() . '" method="get">
<button type="submit" class="button product_type_simple add_to_cart_button ajax_add_to_cart kad-btn headerfont kad_add_to_cart" style="width: 100%;">','More Info', '</button>
</form>';
}
The thing that puzzles me is the fact that this should have no effect on the single product page. The code adds a ‘more info’ button to the products in the category view (like the shop pages).
Even stranger: even if I explicitly state that the code should not run on the specific single product page with the price calculation, it has no effect.
Any ideas why this very small piece of code is messing up uni cpo?
(I’ve been using this snippet for years)
Best
Peter
-
This reply was modified 6 years ago by
jazura.
-
This reply was modified 6 years ago by
jazura.
-
This reply was modified 6 years ago by
jazura.
This is the form, not just button. And it probably adds product to the cart.
Thread Starter
jazura
(@jazura)
Well, no. The point of the button is to direct the user to the single product page instead of adding the product to the cart.
But anyway, I found the solution. Simply omitting ‘product_type_simple’ from the list of classes.
Then it is too much for ‘just a button’. There is a ‘form’ tag, your button is inside it and has type ‘submit’. It submits data via the form. Why? I don’t know. You could just use ‘a’ tag and redirect users to the product page. Why so much complexity?