Member only deals

Short description of issue

Hi there, I am dealing with a cart/update issue. As normal I have deals that are available to all customers and then I have deals that are members only. When a customer has qualifying products for the members only deal in their cart I prompt them to login and register to claim the deal. After a successful login for a customer that is already a member - the cart does not update and the deal does not show in the cart yet until a customer adds or removes a product to trigger the cart update.

Reproduction steps

  1. Create account and register as a member (it is optional)
  2. Logout and add qualifying products
  3. Login again

Although the customer is now logged in and has qualifying products for the members deal in their cart - the deal doesn’t reflect.

Additional info

What I want to achieve is to update the cart after a successful login to cover all cases - but doing this causes in a page refresh.

What type of topic is this

General discussion

@Tiaan_van_Staden have you tried using the Section Rendering API on the cart?

That’ll fix the cart markup, but worth noting the login POST itself is what’s triggering your full page refresh. If you want no reload at all, intercept the login form submit with fetch and prevent default, then on success call the section rendering endpoint for your cart sections and swap in the returned HTML.

@Tiaan_van_Staden :
Guest cart
→ customer logs in
→ cart mutation ( This is what you will need to get the discount calculation recalculate )
→ Discount Function runs with logged-in customer
→ member discount applies

Good catch, that’s the missing piece. A pure section re-render won’t trigger the Function, you need an actual cart write first, even a no-op one like updating the cart note or a line attribute, then fetch the sections after that resolves so the markup reflects the recalculated discount.

This sounds like the cart is not being re-evaluated when the customer session changes after login.

After a successful login, you could trigger a cart refresh/update request (for example, re-fetch /cart.js and then re-render the cart sections) rather than doing a full page reload. If the member discount is applied through Shopify Functions/discount logic, this should give the cart a chance to recalculate based on the newly authenticated customer.

The key is to refresh the cart state after login, not necessarily refresh the entire page.