add_to_cart shortcut not working
-
I had two issues with the ADD_TO_CART shortcode, in THE7 theme.
(1) It was always showing the price.
(2) It had a bizarre graphic as the button background.————————
(1) In this same forum, I found a user’s post showing how to hide the price. It’s dismaying that WooCommerce does not have their shortcodes list up-to-date with info such as this:
Add To Cart – shortcode documentation:
https://docs.woothemes.com/document/woocommerce-shortcodes/#section-9The user’s suggestion worked like a charm:
[add_to_cart id="99" show_price="false"]
(2) Using this shortcut (typing it OR choosing the woocommerce button “add to cart”) produced a garbled button with a graphic that looks like a heart monitor. _/\_/\_
Inspecting the applied CSS, it seems a background graphic is being applied to this class: .product_type_simple:after, .product_type_variable:after
Why and where is this defined in one’s Theme or WP core?Default in “The7” theme:
data:image/svg+xml,%3Csvg%20version=%221.1%22%20xmlns=%22https://www.w3.org/2000/svg%22%20xmlns:xlink=%22https://www.w3.org/1999/xlink%22%20x=%220px%22%20y=%220px%22%20width=%2224px%22%20height=%2224px%22%20viewBox=%220%200%2024%2024%22%20enable-background=%22new%200%200%2024%2024%22%20fill=%22white%22%20xml:space=%22preserve%22%3E%3Cpath%20d=%22M21.229,7.925L16.938,17.7H7.078L2.812,7.925H0v2.33h0.643c0.904-0.021,0.904-0.021,1.257,0.785l3.819,8.901h12.578l3.805-8.9c0.383-0.807,0.383-0.807,1.256-0.786H24v-2.33H21.229L21.229,7.925z%22/%3E%3Cpolygon%20points=%2216.7,8.025%2013.023,8.025%2013.023,11.8%2010.975,11.8%2010.975,8.025%207.3,8.025%207.3,5.976%2010.975,5.976%2010.975,2.2%2013.023,2.2%2013.023,5.976%2016.7,5.976%20%22/%3E%3C/svg%3E
After deobfuscation:
data:image/svg+xml,<svg version="1.1" xmlns="https://www.w3.org/2000/svg" xmlns:xlink="https://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" fill="white" xml:space="preserve"><path d="M21.229,7.925L16.938,17.7H7.64L2.812,7.925H0v2.33h0.643c0.904-0.17,0.904-0.17,1.257,0.785l3.819,8.901h12.578l3.805-8.9c0.383-0.807,0.383-0.807,1.256-0.786H24v-2.33H21.229L21.229,7.925z"/><polygon points="16.7,8.21 13.19,8.21 13.19,11.8 10.975,11.8 10.975,8.21 7.3,8.21 7.3,5.976 10.975,5.976 10.975,2.2 13.19,2.2 13.19,5.976 16.7,5.976 "/></svg>
As much as WooCommerce has great features, there is still a LOT that needs cleanup / fixing / transparency to the rest of the novice community.
At least in the theme I am working with at present, the only choice is to override the style with Custom CSS:
For example:
/* Remove the button background graffiti on woocommerce add_to_cart shortcode */ .product_type_simple:after, .product_type_variable:after, a.button.add_to_cart_button.product_type_simple { background-image: none; color: #000000 !important; } /* And get rid of the ugly border and wasteful padding on woocommerce add_to_cart shortcode */ .product_type_simple:after, .product_type_variable:after, .product.woocommerce.add_to_cart_inline { border: 0px !important; padding: 0px !important; }
- The topic ‘add_to_cart shortcut not working’ is closed to new replies.