Disable add to cart w/o tracking inventory

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MattS
    Mini Mivite

    • Sep 2021
    • 17

    #1

    Disable add to cart w/o tracking inventory

    Our store does not track inventory - wondering if there is any way to manually remove the add to cart button & display an out of stock message w/o enabling inventory tracking?
  • kocourek
    Mini Mivite


    • Mar 2013
    • 81

    #2
    There are many ways to accomplish this. How you go about it really relies on how you want to maintain the out-of-stock data and how comfortable you are with updating template code.

    If you are deadset on implementing a manual Out Of Stock system, be sure to implement it everywhere a customer can add that product to their cart on your website, not just the product page.

    At a high level, if I were to build a manual Out of Stock system, I would start with a new product checkbox custom field called "OutOfStock" and include that custom field on the templates that need to have the buy button toggled. Then within template code wrap your add to cart buttons with an mvt:if. Something like:

    <mvt:if expr="l.settings:product:customfield_values:custom fields:outofstock">
    // out of stock messaging
    <mvt:else>
    //add to cart code
    </mvt:if>

    This would allow you to check a custom field and toggle between Out of Stock and Add to Cart.

    Comment

    • oliverands
      Mivite








      • Jun 2010
      • 428

      #3
      There might be an easier way to do this. For items that you want to take out of stock (and only for those items), you can set the product to track inventory and set inventory to 0. All other items will not be tracking inventory. If a customer attempts to add one of these products to the cart, they will get the out of stock page where you can customize the messaging. Alternately, you could modify the template code on the PROD page by wrapping the add to cart button with a conditional statement (just as kocourek mentions) saying that if inventory equals 0 do not show the button but display the message you want.
      Todd Gibson
      Oliver + S | Sewing Patterns for Kids and the Whole Family

      Comment

      • kocourek
        Mini Mivite


        • Mar 2013
        • 81

        #4
        Upvote to you oliverands I agree with turning on inventory only for products that you want out of stock. It is simpler to maintain and a better approach overall.

        Comment

        • MattS
          Mini Mivite

          • Sep 2021
          • 17

          #5
          Originally posted by oliverands View Post
          There might be an easier way to do this. For items that you want to take out of stock (and only for those items), you can set the product to track inventory and set inventory to 0. All other items will not be tracking inventory. If a customer attempts to add one of these products to the cart, they will get the out of stock page where you can customize the messaging. Alternately, you could modify the template code on the PROD page by wrapping the add to cart button with a conditional statement (just as kocourek mentions) saying that if inventory equals 0 do not show the button but display the message you want.
          This sounds like it would be a great solution, thanks for the replies! I wasn't aware you could track inventory on the product level where do you enable this?

          Comment

          • kocourek
            Mini Mivite


            • Mar 2013
            • 81

            #6
            Turn on track inventory at a store level Catalog > Inventory > Inventory Settings. This is where you'd set your global out-of-stock messaging as well. Then on each product, there will be an inventory tab where you can toggle "Track Product". If you have a lot of products, inventory tracking at a product level can be updated using MIVA's data management. "Add/Update Products from CSV"

            Comment

            • MattS
              Mini Mivite

              • Sep 2021
              • 17

              #7
              Originally posted by kocourek View Post
              Turn on track inventory at a store level Catalog > Inventory > Inventory Settings. This is where you'd set your global out-of-stock messaging as well. Then on each product, there will be an inventory tab where you can toggle "Track Product". If you have a lot of products, inventory tracking at a product level can be updated using MIVA's data management. "Add/Update Products from CSV"
              I was trying to avoid turning on global inventory tracking. If I do enable it does MIVA default to having it turned on or off for products?

              Comment

              • Leanne
                Mega Mivite






                • Mar 2006
                • 2666

                #8
                The default is to have it off. So it will only track products where you specifically enable it.

                Comment

                Working...
                X