Welcome to the Liquify Community

Updated 2 weeks ago

Subscription Price Update

I'm having a bit of an issue with adding a subscription product to my cart on the site I'm developing. I've tried a few different methods of an add to cart button, but none of them seem to grab the correct pricing info for the subscription. Is there something else I have to do? I have the same problem on both the home page, and the product page itself. If you look on the product page you'll notice I currently have three add to carts - one of them is an individual custom button outside of a form, one is a custom element inside a form which doesn't work at all and the third is copy pasted from the liquify template

https://6ezvg1y1fyqn69lb-71191494959.shopifypreview.com
J
j
f
57 comments
Hey @fergie77, I think for that you would need to use the native Shopify form submit. So you would remove the liquify attributes from the button and the product-variant-container and use an actual submit button to submit the form. I did this some time ago at this shop:

Webflow: https://preview.webflow.com/preview/filbec-shop?utm_medium=preview_link&utm_source=designer&utm_content=filbec-shop&preview=2e903db79948c9938579805d4b825151&pageId=659543a2c6d80201e6a82c4e&locale=en&workflow=preview

Live:
https://filbec.de/

For the mini cart to work you would probably need some JS, but I have't looked into that. In my case, the form just submits instantly to the cart page.
Hi @fergie77, do you have a bit of a time? We will soon launch a new update on the product form which will submit all the form submits. When the problem is not that urgent i would suggest to wait for this update ๐Ÿ™‚
How long roughly do you think? Iโ€™d like to get the site live sooner than later
we are in the final testing. I cant make a promise but i would say next week
Okay I can wait for that! Thanks for letting me know
@jonas.halbstark Is it still looking like it might be this week?
Hi @fergie77, the update is live and you can already test it. Are you using the normal subscription app?
Brilliant Iโ€™ll give it a go! Itโ€™s Seal Subscription that weโ€™re using
Okay all working perfectly now, thank you for the update!! The only thing I've noticed is different is that my prices aren't coming through formatted. I'm using x-text as the attribute so that the variants change the price. Do I have to add something?
Can you send us a new preview link? I think the previous one expired :) @fergie77
Hmm, we changed something with the object properties to get closer to the liquid syntax. Can you try product.price instead of price?
Or maybe use the moneyFormat function: x-text="LiquifyHelper.moneyFormat(price)"
Will product.price still update dynamically?
Jup, we restructured the Alpine objects. Normally everything should still work with the old properties, but something might have been overlooked
Great Iโ€™ll give that a go, thank you!
Is this correct? It's not updating anymore when I pick variants
It stillt needs to be x-text or li-js-object. So in your case: x-text="product.price" or x-text="LiquifyHelper.moneyFormat(price)"
I haven't tested it. so I'm not really sure which one would fix the issue for now
This worked perfectly - x-text="LiquifyHelper.moneyFormat(price)" but the others didn't display a price at all
The only problem I'm having now is how to get my subscription amount to update when the variant changes. It should be 31.50 rather than 8.10
@jonas.halbstark Could you take a look at this please?
Hi @fergie77 does seal subscription offer a funtionality like this to update the prdouct price based on the selected selling plan? If not that should be doable by alpine. can you send me another preview link?
So i tested a bit and i would say the best solution would be the section rendering api to fetch the new content whenever something is changed in the product form. Just let me build an example so you can copy it.
That's brilliant, thank you! Really appreciate the help, it's the last thing we have to do before we go live
Hi @fergie77,
im proud of my self to introduce a completly native solution. https://webflow.com/made-in-webflow/website/liquify-compoenents

You can find it under product heroes. Its the last one ๐Ÿ™‚
So this just uses the selling plan which seals subscription creates. You can copy the subscription elemnt over. Just keep in mind to also set an x-data="{selling_plan: '{{ product.selected_or_first_available_variant. selected_selling_plan_allocation.selling_plan.id }}', sellingplan_active: false }" attribute around the subscription module and price.
to keep the sellingplan price reflected in the product price you can replace the li-js-price="price" with li-js-price="product.selected_or_first_available_variant.selling_plan_allocations.find(allocation => allocation.selling_plan_id == selling_plan)?.price ?? price"
Just style it however you like and you are good to go.
My man you are fantastic thank you! I'll get that implemented asap and let you know how I get on
nice ๐Ÿ™‚ looking forward
is this x-data selling_plan etc to go on the seal subscriptions element?
you dont need the seal subscription element any more
its just raw html with a bit of alpine js. We just use the same information from the selling plan which seal subscription creates
Ahh okay, it seems like it's being automatically added so I'll take a look and see how to disable that
So do you mean this price and the subscription element should be in the same div? With the x-data as an attribute on that parent div
so its not necessary the same div but the the x-data attributes needs to be on a parent of both elements.
Ah okay that's cool
and then you can sytle it the way you want
So this is almost working my side, but it seems to be stripping out the checkboxes for the selling plans.
Here's the share link again if it's easier to see here
i think that app is removing it. At first i can see them and when the app loads they disapear
Two secs I'll see if I can disable that
You are correct! Working now, thank you
you can also display this information in the cart then. by using li-js-object="product.selling_plan_allocation.selling_plan.name"
Will selling_plan.price return the price after discount of each plan? So they can go next to the checkboxes
I think this should be showing up but it's not?
its just plan.price ๐Ÿ™‚
Sorry this one is a bit off topic but I have the recommended section from the template. Is there a way to hide it if there's nothing recommended?
Yes sure ๐Ÿ™‚ you can use li-if="recommendations.products != blank"
just out it on an element inside the element where the data-url is applied
Add a reply
Sign up and join the conversation on Discord