Apparent shortcode bug
-
Been having this error for a few months, up to the latest current version.
I’m having an issue with one shortcode, which looks like:
[products limit=”6″ columns=”3″ orderby=”id” order=”DESC” visibility=”visible”]The problem I’m having is that it sometimes renders the li wrong, which messes up the layout.
1. I’m importing new products through a plugin I’ve written myself, using “new WC_Product()”. Everything works, most of the time but…
2. Every once in a blue moon something happens to a product. It looks the same everywhere except when used in a shortcode. It then renders the
li
wrong, as such:<li class=""> <a href="" class="woocommerce-LoopProduct-link woocommerce-loop-product__link"><div class="wc-product-image"><div class="inside-wc-product-image"><img width="300" height="300" src="https://website.com/wp-content/uploads/2019/01/2666238763-300x300.jpg" class="attachment-woocommerce_thumbnail size-woocommerce_thumbnail" alt="" srcset="https://website.com/wp-content/uploads/2019/01/2666238763-300x300.jpg 300w, https://website.com/wp-content/uploads/2019/01/2666238763-150x150.jpg 150w, https://website.com/wp-content/uploads/2019/01/2666238763-100x100.jpg 100w" sizes="(max-width: 300px) 100vw, 300px"></div></div><h2 class="woocommerce-loop-product__title"></h2><div class="star-rating" title="Not yet rated"><span style="width:0%"><strong class="rating">0</strong> out of 5</span></div> <span class="price"><span class="woocommerce-Price-amount amount">119,900<span class="woocommerce-Price-currencySymbol">kr</span></span></span> </a><a href="https://website.com/produkt/saab-9-3-aero-v6-2-8-turbo-280hk-xwd-08/" data-quantity="1" class="button product_type_blocket add_to_cart_button" data-product_id="3257" data-product_sku="blocket_83043361" aria-label="L?s mer om “Saab 9-3 Aero V6 2.8 Turbo 280hk XWD -08”" rel="nofollow">L?s mer</a></li>
instead of the correct:
<li class="post-3257 product type-product status-publish has-post-thumbnail product_cat-produkter sales-flash-overlay woocommerce-text-align-center woocommerce-image-align-center wc-has-gallery last instock shipping-taxable purchasable product-type-blocket"> <a href="https://website.com/produkt/saab-9-3-aero-v6-2-8-turbo-280hk-xwd-08/" class="woocommerce-LoopProduct-link woocommerce-loop-product__link"><div class="wc-product-image"><div class="inside-wc-product-image"><img width="300" height="300" src="https://website.com/wp-content/uploads/2019/01/2674762082-300x300.jpg" class="secondary-image attachment-shop-catalog" alt="" srcset="https://website.com/wp-content/uploads/2019/01/2674762082-300x300.jpg 300w, https://website.com/wp-content/uploads/2019/01/2674762082-150x150.jpg 150w, https://website.com/wp-content/uploads/2019/01/2674762082-100x100.jpg 100w" sizes="(max-width: 300px) 100vw, 300px" style="opacity: 0;"><img width="300" height="300" src="https://website.com/wp-content/uploads/2019/01/2666238763-300x300.jpg" class="attachment-woocommerce_thumbnail size-woocommerce_thumbnail" alt="" srcset="https://website.com/wp-content/uploads/2019/01/2666238763-300x300.jpg 300w, https://website.com/wp-content/uploads/2019/01/2666238763-150x150.jpg 150w, https://website.com/wp-content/uploads/2019/01/2666238763-100x100.jpg 100w" sizes="(max-width: 300px) 100vw, 300px"></div></div><h2 class="woocommerce-loop-product__title">Saab 9-3 Aero V6 2.8 Turbo 280hk XWD -08</h2><div class="star-rating" title="Not yet rated"><span style="width:0%"><strong class="rating">0</strong> out of 5</span></div> <span class="price"><span class="woocommerce-Price-amount amount">119,900<span class="woocommerce-Price-currencySymbol">kr</span></span></span> </a><a href="https://website.com/produkt/saab-9-3-aero-v6-2-8-turbo-280hk-xwd-08/" data-quantity="1" class="button product_type_blocket add_to_cart_button" data-product_id="3257" data-product_sku="blocket_83043361" aria-label="L?s mer om “Saab 9-3 Aero V6 2.8 Turbo 280hk XWD -08”" rel="nofollow">L?s mer</a></li>
3. This is fixed by going into the product, and resaving it without changing anything else.
4. The weird thing though is: If I do a database dump when it’s glitched, and compare it to a database dump after I’ve resaved it, there are 0 differences.
5. My first thought was that it was some character/encoding issue somewhere which was fixed by the resave, but no, none, nada, nothing.
Any thoughts?
- The topic ‘Apparent shortcode bug’ is closed to new replies.