Tagged: x
-
AuthorPosts
-
September 30, 2016 at 10:15 am #1197385
Rich RParticipantHello!
I wanted to see what the best way you recommend I go if I wanted to remove this button on selected pages.
It’s the one titled “promo pricing available” and it’s next to the “add to cart” button on all products but we have some used items that do not qualify for special pricing.
I am currently using this line of code recommended by this forum.
add_action(‘woocommerce_after_add_to_cart_button’,’cmk_additional_button’);
function cmk_additional_button() {
echo ‘Promo Pricing Available – CALL NOW!‘;
}Thanks!
September 30, 2016 at 3:00 pm #1197773
DarshanaModeratorHi there,
You can use the following code for that and set your WooCommerce Post ID (Eg:96). You can locate post IDs as follows (https://community.theme.co/kb/how-to-locate-post-ids/).
add_action('woocommerce_after_add_to_cart_button','cmk_additional_button'); function cmk_additional_button() { if (!is_single('96')) { echo "<a href='http://your.link/to' class='my-promo-btn x-btn'>Promo Pricing Available – CALL NOW!</a>"; } }Hope that helps.
October 6, 2016 at 10:33 am #1205191
Rich RParticipantThanks!
That will come in handy for when I need to remove a button from a single product.
However, I am looking for a way to apply it to a specific category of products.
In this case, I am referring to the “used equipment” page where there are over 40 products that will not need the “Call for Promo” button.
I have tried… is_single, is_page, is_category, array, all the post id’s, etc with no luck.
What else do you think I should try?
October 6, 2016 at 12:28 pm #1205405
RupokMemberHi there,
In that case I could suggest you to remove with CSS.
You can add this under Custom > CSS in the Customizer..product_cat-used-equipment .my-promo-btn.x-btn { display: none; }Hope this helps.
October 6, 2016 at 1:01 pm #1205466
Rich RParticipantThank you that works!
Should I remove the old/dead code from functions.php?
October 6, 2016 at 2:00 pm #1205545
JoaoModeratorHi Rich,
Please use just the code Darshana provided you.
Thanks,
Joao
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1197385 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
