Home › Forums › WoodMart support forum › show Before "Add to cart button" text area in specific product category
show Before "Add to cart button" text area in specific product category
- This topic has 13 replies, 3 voices, and was last updated 4 years, 9 months ago by Artem Temos.
-
AuthorPosts
-
February 18, 2020 at 10:22 am #174240
nicksfikasParticipantHi,
I want to show the Html code in Before “Add to cart button” text area for specific product categories. Can you help me?
thanksFebruary 18, 2020 at 10:47 am #174248
nicksfikasParticipantBasically I want to show it only for products that have a specific attribute
February 18, 2020 at 10:48 am #174249
Aizaz Imtiaz AwanKeymasterHello,
I visited the URL you provided. Unfortunately, you could not add HTML Block in the before Add to Cart Button for separate product categories.
You need to use it in the product short description area from edit product for specific products of the category.
Screenshot for Clarification: https://ibb.co/ZB3GwJx
Best Regards.
February 18, 2020 at 10:51 am #174250
nicksfikasParticipantI want to show the Html for all the products with a specific attribute.
February 18, 2020 at 10:51 am #174251
nicksfikasParticipantwhat about the child? How about adding a code in the child theme?
February 18, 2020 at 12:40 pm #174280
Aizaz Imtiaz AwanKeymasterHello,
You need to add the following code into your child theme functions.php file.
add_action( 'woocommerce_before_add_to_cart_form', 'htdat_content_after_addtocart_button' ); function htdat_content_after_addtocart_button() { // NOTE: replace your category slugs for 'category-01' and 'category-02' if ( is_product() && has_term( array( 'accessories', 'furniture' ), 'product_cat' ) ) { echo '<div style="clear: both"></div>'; echo do_shortcode ('[html_block id="2965"]'); } }
NOTE: replace your category slugs for ‘accessories’ and ‘furniture’ and replace the html block shortcode with yours.
Best Regards.
February 18, 2020 at 5:34 pm #174385
nicksfikasParticipantbut I want to show the Html code only for products that have value in specific attribute
February 19, 2020 at 6:56 am #174462
Aizaz Imtiaz AwanKeymasterHello,
Unfortunately, we could not provide you with the code you want. Because it’s WooCommerce plugin customization.
You can try contacting the WooCommerce support for this. Or you can use any third party plugin that better meets your requirements.
Best Regards.
February 24, 2020 at 10:43 am #175697
nicksfikasParticipantno, you did not understand
I want the code that you sent me but I want to check for a product attribute, not a categoryFebruary 24, 2020 at 12:16 pm #175738
Aizaz Imtiaz AwanKeymasterHello,
As I mentioned in my previous reply. Unfortunately, we could not provide you with the code you want. Because it’s WooCommerce plugin customization.
You can try contacting the WooCommerce support for this. Or you can use any third party plugin that better meets your requirements.
Best Regards.
February 24, 2020 at 12:30 pm #175747
nicksfikasParticipantbut it has to do with your theme’s function
February 24, 2020 at 1:11 pm #175769
Artem TemosKeymasterSorry, but we don’t have a code for such a purpose. It may require additional code customization but it is out of our theme support scope.
Regards
February 28, 2020 at 9:37 am #176846
nicksfikasParticipantit is your theme function.
You sent me a code for categories, why won’t you send me a code for attributes?February 28, 2020 at 2:07 pm #176853
Artem TemosKeymasterNo, it is not our native theme’s function and it can work for the categories only. We don’t have a snippet for product attributes. Sorry, but additional code customizations are out of our theme support scope.
-
AuthorPosts
- You must be logged in to create new topics. Login / Register