Global add on in category page
-
Hi All
I am trying to add a global add on to be displayed under each product in category page and not only in the product page.
I want to add a custom text field. So I want my customers to be able to just type in their options in the custom field and click add to cart without having to click on the product and taken to the product page.
I have been able to do that with attributes by adding this code to function.php
Hope someone can help.
if ( ! function_exists( ‘woocommerce_template_loop_add_to_cart’ ) ) {
function woocommerce_template_loop_add_to_cart() {
global $product;if ($product->product_type == “variable” && (is_product() || is_product_category() || is_product_tag())) {
woocommerce_variable_add_to_cart();
}
else {
woocommerce_get_template( ‘loop/add-to-cart.php’ );
}
}}
- The topic ‘Global add on in category page’ is closed to new replies.