Custom Text Field for Shopify Cart and Products

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

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

  • @DesignerMichaelMoyson
    @DesignerMichaelMoyson 3 месяца назад

    Nice and interesting video, you clearly know a lot about shopify development, good job! You gave me new insights on how to fix a problem :)

    • @nickdrishinski
      @nickdrishinski  3 месяца назад +1

      @@DesignerMichaelMoyson thank you so much 🙏

  • @hel5376
    @hel5376 2 месяца назад

    Thank you! How do you adjust the length of the textbox?

    • @nickdrishinski
      @nickdrishinski  2 месяца назад

      Thanks for the comment! To adjust the width of the textbox you would just add the width to the styles. For example:
      #cart_attribute input {
      ...
      width: 150px;
      }

  • @michaelhirt3915
    @michaelhirt3915 5 месяцев назад +1

    amazing

  • @OmerAbbas-s7r
    @OmerAbbas-s7r 2 месяца назад

    how can we make this field required

    • @nickdrishinski
      @nickdrishinski  2 месяца назад

      Thanks for the comment. There's a few ways I can think about achieving this.
      1. Hijack the 'add to cart' via JavaScript, and reject the request if it does not contain the text field value. (Probably the one I would choose).
      2. Listen for changes to cart and write a script to check if the required field is there, if not remove it and provide a notification why
      3. Listen for changes to cart and write a script to check if the required field is there and if it is not, force a modal that the user must fill out.
      4. If you are on Shopify Plus, write a Shopify Function that required that field before checkout.