Shopify Tutorial - Operating Discount Codes in Checkout UI Extensions

Поделиться
HTML-код
  • Опубликовано: 3 фев 2025

Комментарии • 20

  • @Elver_Galarga_Rico
    @Elver_Galarga_Rico 22 дня назад

    Thanks for taking the time to demonstrate this.
    Is it possible to apply/remove discount codes on specific cart line items? Before I'd use Script Editor to prevent discount codes from applying on cart line items if they contained a specific tag. I haven't figured out how to use the Checkout UI Extensions to achieve the dame. The Cart Lines API doesn't remove the discount when the discountAllocations attributes is set to an empty array and the Discounts API doesn't seem to allow targeting a single line item.

    • @stackingcontext
      @stackingcontext  21 день назад

      You will need to use a Shopify Function for this to create a discount that ignores items with certain tag.

  • @KirbyTank
    @KirbyTank 8 месяцев назад

    @Stacking Context thanks for all your videos! I'm learning alot from your videos which are clear and explanatory. I like how you explain the process of where you find certain data.
    Would you be able to do a tutorial on price changes depending on seletected payment methods or other changes during checkout? Like add charge if choosing pay with PayPal or discount if choosing pay with other options.

  • @AbhimanyuArora-df5yb
    @AbhimanyuArora-df5yb 7 месяцев назад +1

    @Stacking Context, if there any way to show the discount coupon on the checkout extension and if we click on it, it get applied autmoatically.

  • @horselditty
    @horselditty 11 месяцев назад

    Great stuff. Is there a similar solution available if store does not have Shopify Plus?

    • @stackingcontext
      @stackingcontext  11 месяцев назад +1

      Not exactly the same, but the upcoming Discount Allocator function also has the ability to reject discount codes: shopify.dev/docs/apps/selling-strategies/discounts/discount-function-examples/discounts-allocator
      Shopify Functions as custom apps are only available to Shopify Plus stores, but if an app from the Shopify App Store is using functions you can install it on non-Plus stores and it should work.

    • @horselditty
      @horselditty 11 месяцев назад

      @@stackingcontext thanks, Im interested in finding something similar to useDiscountCodes() to listen for when users apply discount codes in checkout, but without having to use Checkout UI if possible. I was exploring perhaps Storefront API... would this have a similar listener?

  • @MaxBill-xv7ek
    @MaxBill-xv7ek 3 месяца назад

    Can we hide (discount field) from checkout?

  • @slayerd52
    @slayerd52 10 месяцев назад

    do you have a full course?

    • @stackingcontext
      @stackingcontext  10 месяцев назад

      No. Is there any content you'd like to see that has not been covered in the channel yet?

  • @therp07mspl
    @therp07mspl Год назад

    hello @Stacking Context
    Nice work but I want to show all coupon codes from the backend to the cart page as a suggestion so the customer can choose from it

    • @SimonS188
      @SimonS188 11 месяцев назад

      Your best bet would be to store them all in a shop metafield and then display that as a text checkout extension. That being said, it's rarely a good idea to just hand people all your discounts so they can pick the best one for them. Discounts should be used to get people who wouldn't have purchased at full price across the line. By handing everyone all your discount codes, all you're really doing is just making your products cheaper. Which could be more easily achieved by....making your products cheaper.

    • @stackingcontext
      @stackingcontext  11 месяцев назад

      Aside from what @SimonShinkins suggested, you can also get the active discount codes by using the DiscountCodeNode query in your Checkout UI Extension and displaying the results at checkout.

  • @diego_elohim
    @diego_elohim 11 месяцев назад

    I have a discount shopify function that creates a automatic discount.
    What could I do so I can apply another discount on top of the automatic one.
    Could this be done with a checkout extension?
    Example:
    DEMO50 -> 50% automatic percentage
    and
    DEMO30 -> 30% not automatic percentage
    When I apply the last one(DEMO30), a messages appears that I can not use DEMO30
    The message is "DEMO30 couldn't be used with your existing discounts"
    So, Is it possible to apply another discount in addition to the first one?
    Or It is not possible?

    • @stackingcontext
      @stackingcontext  11 месяцев назад

      When registering your discount use the combinesWith field from the API. Both discounts must be set to combine.
      shopify.dev/docs/api/admin-graphql/unstable/input-objects/DiscountAutomaticAppInput

  • @nightcode5281
    @nightcode5281 10 месяцев назад

    Your explanation is amazing and tried to create a shopify UI extension but how to get the coupon code value when it is not a valid one. Which function or hook i need to use?
    And i want to use only default text box and button of shopify checkout
    Currently i am trying to call applydiscountcodechange and usediscount code but these hooks give me only applied coupon code i want which are not valid and cuustomer trying to apply them
    Thank you in advance

    • @stackingcontext
      @stackingcontext  10 месяцев назад

      I'm not aware of a method to get the invalid coupon codes the customer tried to apply.

  • @浜田宏次郎
    @浜田宏次郎 9 месяцев назад

    how to get the information of total discount amount ?

    • @stackingcontext
      @stackingcontext  9 месяцев назад

      You can get all applied discounts using the useDiscountAllocations hook, then sum them and that should be the total amount.
      shopify.dev/docs/api/checkout-ui-extensions/2024-04/apis/discounts#useDiscountAllocations