helgatheviking / add-to-cart-form-shortcode

Add [add_to_cart_form] shortcode that display a single product add to cart form for WooCommerce
21 stars 7 forks source link

Recent Woo update broke plugin with variable products? #12

Open pierrerocket opened 1 year ago

pierrerocket commented 1 year ago

Hi. We just had a client report that the shortcode isnt working correctly with variable products all of the sudden.

Inside the variations_form div you start to see malformed or escaped code?:

`<span class="\"woocommerce-Price-amount" amount\"="">$<\/span>568.00<\/bdi><\/span><\/span>","sku":"EVC3AA0A2E1A1","variation_description":"","variation_id":112,"variation_is_active":true,"variation_is_visible":true,"weight":"15","weight_html":"15 lbs","woofs_image":"<img width="\"300\"" height="\"300\"" src="\"https:\/\/evocharge.com\/wp-content\/uploads\/2021\/01\/3-1-300x300.jpg\"" class="\"attachment-woocommerce_thumbnail" size-woocommerce_thumbnail\"="" alt="\"\"" decoding="\"async\"" loading="\"lazy\"" srcset="\"https:\/\/evocharge.com\/wp-content\/uploads\/2021\/01\/3-1-300x300.jpg" 300w,="" https:\="" \="" evocharge.com\="" wp-content\="" uploads\="" 2021\="" 01\="" 3-1-1024x1024.jpg="" 1024w,="" 3-1-150x150.jpg="" 150w,="" 3-1-768x768.jpg="" 768w,="" 3-1-600x600.jpg="" 600w,="" 3-1-100x100.jpg="" 100w,="" 3-1-50x50.jpg="" 50w,="" 3-1.jpg="" 1080w\"="" sizes="\"(max-width:" 300px)="" 100vw,="" 300px\"="">","display_price_cents":56800},{"attributes":{"attribute_pa_cable-length":"25-cable"},"availability_html":"","backorders_allowed":false,"dimensions":{"length":"16","width":"15","height":"11"},"dimensions_html":"16 × 15 × 11 in","display_price":599,"display_regular_price":599,"image":{"title":"EVSE-32-Amp-Home-Charger","caption":"","url":"https:\/\/evocharge.com\/wp-content\/uploads\/2021\/01\/3-1.jpg","alt":"EVSE-32-Amp-Home-Charger","src":"https:\/\/evocharge.com\/wp-content\/uploads\/2021\/01\/3-1-600x600.jpg","srcset":"https:\/\/evocharge.com\/wp-content\/uploads\/2021\/01\/3-1-600x600.jpg 600w, https:\/\/evocharge.com\/wp-content\/uploads\/2021\/01\/3-1-300x300.jpg 300w, https:\/\/evocharge.com\/wp-content\/uploads\/2021\/01\/3-1-1024x1024.jpg 1024w, https:\/\/evocharge.com\/wp-content\/uploads\/2021\/01\/3-1-150x150.jpg 150w, https:\/\/evocharge.com\/wp-content\/uploads\/2021\/01\/3-1-768x768.jpg 768w, https:\/\/evocharge.com\/wp-content\/uploads\/2021\/01\/3-1-100x100.jpg 100w, https:\/\/evocharge.com\/wp-content\/uploads\/2021\/01\/3-1-50x50.jpg 50w, https:\/\/evocharge.com\/wp-content\/uploads\/2021\/01\/3-1.jpg 1080w","sizes":"(max-width: 600px) 100vw, 600px","full_src":"https:\/\/evocharge.com\/wp-content\/uploads\/2021\/01\/3-1.jpg","full_src_w":1080,"full_src_h":1080,"gallery_thumbnail_src":"https:\/\/evocharge.com\/wp-content\/uploads\/2021\/01\/3-1-100x100.jpg","gallery_thumbnail_src_w":100,"gallery_thumbnail_src_h":100,"thumb_src":"https:\/\/evocharge.com\/wp-content\/uploads\/2021\/01\/3-1-300x300.jpg","thumb_src_w":300,"thumb_src_h":300,"src_w":600,"src_h":600},"image_id":10192,"is_downloadable":false,"is_in_stock":true,"is_purchasable":true,"is_sold_individually":"no","is_virtual":false,"max_qty":"","min_qty":1,"price_html":"<span class="\"woocommerce-Price-amount" amount\"="">$<\/span>599.00<\/bdi><\/span><\/span>","sku":"EVC3AA0B2E1A1","variation_description":"","variation_id":113,"variation_is_active":true,"variation_is_visible":true,"weight":"17","weight_html":"17 lbs","woofs_image":"<img width="\"300\"" height="\"300\"" src="\"https:\/\/evocharge.com\/wp-content\/uploads\/2021\/01\/3-1-300x300.jpg\"" class="\"attachment-woocommerce_thumbnail" size-woocommerce_thumbnail\"="" alt="\"\"" decoding="\"async\"" loading="\"lazy\"" srcset="\"https:\/\/evocharge.com\/wp-content\/uploads\/2021\/01\/3-1-300x300.jpg" 300w,="" https:\="" \="" evocharge.com\="" wp-content\="" uploads\="" 2021\="" 01\="" 3-1-1024x1024.jpg="" 1024w,="" 3-1-150x150.jpg="" 150w,="" 3-1-768x768.jpg="" 768w,="" 3-1-600x600.jpg="" 600w,="" 3-1-100x100.jpg="" 100w,="" 3-1-50x50.jpg="" 50w,="" 3-1.jpg="" 1080w\"="" sizes="\"(max-width:" 300px)="" 100vw,="" 300px\"="">","display_price_cents":59900}]">

`

You can view that on the live site here: https://evocharge.com/home-charging-solutions/

(click buy now under evse or 32 amp ievse). We recently updated to wp 6.2 and the latest woo. Site was working fine before that I believe. Any idea what is going on here?

helgatheviking commented 1 year ago

Hi Pierre. Thanks for the report. I am using Woo 7.6.0 and can't reproduce this, see my own example site: https://mnm.kathyisawesome.com/add-to-cart-form/

I'm gonna suggest you go through the debugging process: switch to a default theme and then disable plugins one at a time. It's admittedly a bit tedious, but it's still the most reliable way I've found. If you can repro this in a default environment then we know there's something I need to dig into more.

Looking at your site, could it be related to how you've set up your modals?