Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Re: product.selling_plan_groups array (liquid) is sometimes empty

Solved

product.selling_plan_groups array (liquid) is sometimes empty

Etra
Shopify Partner
39 0 21

In our liquid template, we check if `product.selling_plan_groups.size > 0` (confirming a product has a selling plan group attached) and display some HTML if so. We recently started getting reports that the HTML was not being rendered. After further investigation, we found that if the `cache` was cleared then `product.selling_plan_groups` would be empty even if the product has a selling plan group attached. So a first-time visitor to a merchant's store would not see the HTML since `product.selling_plan_groups` has a size of 0. 

Etra_0-1691609241813.pngEtra_1-1691609280071.png


We have replicated the issue on Chrome, Firefox, and Safari for the Dawn and Debut themes.

Accepted Solution (1)

LarryReid
Shopify Staff
87 9 22

This is an accepted solution.

We shipped a fix for this 2023-08-15 15 h 00 UTC approximately. Please let us know if it's still not working.

To learn more visit the Shopify Help Center or the Community Blog.

View solution in original post

Replies 13 (13)

Liam
Community Manager
3108 344 910

Hi Etra,

 

If you change the condition to `{% if product.selling_plan_groups.size != blank %}` is the HTML rendering as you'd expect?

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Etra
Shopify Partner
39 0 21

@Liam The condition passes but that does not change the fact that the data from the product liquid object still does not have the correct selling_plan_groups data. It is still empty. If I make some changes(even just adding a comment) to the template then the data is loaded correctly and it works. Again this issue happens(data is incorrect) upon the initial page load. On other page loads the data is there and correct. 

This product definitely has a selling plan group attached. Here is the initial page load:

Etra_0-1691771119678.png

 

Etra
Shopify Partner
39 0 21

@Liam I mean you can even see above the product requires a selling plan. requires_selling_plan: true

So how can the array be empty if it requires a selling plan. I can give you example merchant links in private if you like where I am able to replicate it consistently. 

Etra
Shopify Partner
39 0 21

This is a serious issue. I don't know why this hasn't been looked at. Many merchants are starting to reach out to our support about it. For years it has worked just fine. Nothing has changed on our end in terms of using liquid objects to display some selling plan groups. Other apps do this and even some themes as well. Everyone is affected, merchants, customers, app developers. This needs to be fixed...

Liam
Community Manager
3108 344 910

Hi Etra - our dev teams are still working on a fix for this, will update when I learn more. 

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Ugurcan
Shopify Partner
351 7 34

@Liam this is still empty for me on a dev store. I can confirm Selling Plan is created and product is associated with the plan group but still empty.

Any ideas?

Pasilobus | eCommerce Experts, Shopify Apps & Development since 2015 -- www.pasilobus.com
LarryReid
Shopify Staff
87 9 22

Thanks for letting us know. Please post your question in a new topic in this forum, with a complete description of how to reproduce it. The original problem was definitely fixed and has not regressed, so this is a new problem. Thanks in advance.

To learn more visit the Shopify Help Center or the Community Blog.

colins8
Shopify Partner
3 0 2

@Liam We are also experiencing this issue on multiple stores too. It has lead to broken add to cart functionality and customer complaints. After having worked for months, without any code or product/selling plan changes `{{ variant.selling_plan_allocations[0].selling_plan.id }}` started outputting nothing for a period of time, before fixing itself. `{{ variant.id }}` continued to output as expected. This has happened at least two times that we are aware of ~15:00 UK time on August 10th, and again yesterday (August 14th) ~18:15 UK time.

LarryReid
Shopify Staff
87 9 22

This is an accepted solution.

We shipped a fix for this 2023-08-15 15 h 00 UTC approximately. Please let us know if it's still not working.

To learn more visit the Shopify Help Center or the Community Blog.

Etra
Shopify Partner
39 0 21

Will do, thank you.

Bhvavdip
Shopify Partner
2 0 0

The same issue is occurring in my store.

olatief
Shopify Partner
1 0 3

Found this thread because it's still an issue for us.

MC_Elliot
Shopify Partner
3 0 5

Hi,
Has the solution for this problem been found in the end?
I would like to display the discounted prices based on the selling_plan, but the arrays remain empty.