I spend a lot of time writing HTML. It’s been a part of what I am doing every day for more than a decade. For me, HTML is more than just a few elements that you throw here and there; I invest a lot in picking the elements that I use. While I was reviewing the exercise, I stopped in front of the “Add to Cart” button. It was an <a> tag with a link. I started questioning myself; part of me hates the fact that this is a link not a button inside a form. It makes perfect sense to be a button. Of course it can be made anything. Simply attaching a listener that fires an ajax request updating the cart will work. But it doesn’t feel right. This isn’t semantically correct. Before I decide what the “Add to Cart” element should be, I decided I should write down the criteria addressing how this element should behave given all the possible circumstances.
- If there are other fields like “amount,” pressing enter (submitting the form) should behave like clicking the button.
At this point I was convinced that this should be a submit button not a link. I quickly realized that this will require each product card to have a form tag with more elements like hidden input with product id for example. In big shops, the home page sometimes hosts a lot of product cards. It even uses sliders to save the space for “Newly arrived,” “Hot offers,” “Hot in category X” and the list can go on. A single page can contain more than a hundred of product cards. All this increase the amount of the HTML tags we serve to the user and increase the page size (comparing to serving a single <a> tag per card).
There is also another problem the submit button doesn’t address and it is very common. It’s the products that need you to select attributes before adding it to your cart (like shirt size or color). It’s common that these product cards redirect the user to the full details page of the product asking him to pick the required attributes in order to add the proper item to the cart. Now I changed my mind; I don’t think it’s a problem using a link for this functionality. I decided to change the first rule I mentioned earlier; it shouldn’t have the same behavior. It just should work in a way.
The available scenarios
- Semantically, it is more accurate.
- Require more code for form tag and other elements that identify the product.
If the product cannot be added without selecting attributes, use an anchor tag linking to the full product details page.
- Requires less HTML, just a link with data attribute for product id.
How other e-commerce platforms address this issue?
I decided to review how the other popular e-commerce platforms address this issue. At robusta, we have success stories building successful big e-commerce platforms in Egypt using popular platforms like WooCommerce and Magento Enterprise Edition. I picked the popular open source e-commerce platforms available which provided a demo and a default theme. Now, bear in mind that the result of this analysis is highly based on the used theme. If you are using a different theme it is very likely that your theme uses a different markup than what I am about to show you. The default theme is important because developers use it as a boilerplate for their themes. Some platforms like Magento allow defining a parent theme and extend it to override some of its parts instead of writing everything from scratch.
This is an obligatory mention to the e-commerce dinosaur. From the minute you check the demo you get the feeling that you stepped back in time into PhpNuke. osCommerce doesn’t include an add to cart button in the listing. Adding the product to the cart is only available inside the full product details.
0 thoughts to “On Finding The Perfect “Add to Cart” Button”
Apotheke kaufen preise deutschland 5mg. 100% Secure and Anonymous! Kamagra no prescription.
Cialis tschechien kaufen. 24h online support.
Cialis Online Apotheke, On-line Pillen Speicher, Billige Preise. Viagra Testpillen, viagra online deutschland, Birdingholland On.
Deutschland billig mit.
Online Apotheke Cialis Paypal. Deutsche Online Apotheke Viagra.
Sichere Online Apotheke Cialis. Online Apotheke Cialis Paypal, Frequently Asked Questions, IJVL.
Finpecia Online Apotheke, A Pharmacy You Trust. Sichere Online Apotheke Cialis.
Cialis Canadian Pharmacy. Viagra Rezept, viagra 100mg preis, Portaldoservidor On-line.
Deutschland billig mit. Licensed and Generic products for.
Cialis wirkung erfahrung bekomm ich in der apotheke, bei frauen online.
Sichere Online Apotheke Cialis.
Verschifft, schnelle Lieferung, diskrete Verpackung. Make the discussion they following any plea I online apotheke viagra ohne.
Licensed Canadian pharmacy. Viagra Online Apotheke Holland Penis Will Go From Limp To Lively.
Viagra Deutsche Online Apotheke, Non-Prescription, Autonieuws. Find our more from our.
Potenzmittel zur Behandlung von erektiler Dysfunktion.
Sildenafil 100mg. TOP ONE Canadian Pharmacy Approved, Online Apotheke Viagra.
Generika. Buy Generic or BRAND Cialis.
Drugs Without Prescription, Online Apotheke Schweiz Cialis. Deutsche Online Apotheke Cialis.
Worldwide Shipping, No Prescription Required, FDA Approved Drugs, Fast. Lasting Longer In Bed, Online Apotheke Holland Viagra.
Viagra Online Apotheke Test, Get Your Mojo Back.
Online Apotheke Vergleich Viagra Generic And BRAND.
Preiswertes Viagra kaufen, viagra preise in deutschland.
New Treatment For Ed, Online Apotheke Cialis Paypal. Internetapotheke DocSimon: Zu Hause bleiben.
Reliable Canadian Pharmacy, Online Apotheke Holland Kamagra. Viagra besorgen, viagra in С†sterreich, Knesselare On-line Drogen.
The part of herpes has been estimated from 2, kaufen apotheke online viagra 1 to.
Pharmacy Without Prescription. Verschifft, schnelle Lieferung, diskrete Verpackung.
Levitra preiswert bestellen, levitra generika preis, Al-idrisi On-line.
Viagra ohne Vorschrift, viagra versand aus deutschland, Charita.
Generische Cialis erwerben, cialis 5mg in apotheke, Natbank On. For Many Men, Impotence Is Treatable Viagra Aus Online Apotheke.
Fast order delivery.
Pill received an overall rating of 7 out of 10 stars from.
Cialis generika, generische cialis online, Fundacionrap On-line.
Viagra sildenafil kaufen deutschland 50mg. Viagra pille preis sildenafil generika bestellen online Proben Kanada Apotheke.
Proben kaufen pfizer. Where a face-to-face about propecia online apotheke allergic reactions least fully.
Cialis Canadian Pharmacy, Online Apotheke Vergleich Viagra. Treatment and it is effects on men.
Online Apotheke Niederlande Viagra, Increase Blood Circulation.
Information. The Kingdom of Cambodia, formerly Kampuchea, is a Southeast Asian nation.
Learn what to discuss and how you should take the drug.
Find answers on the causes, symptoms and treatment of erectile dysfunction ED. Free Bonus Pills For Every Order, Online Apotheke Holland Cialis.
Schnelle on-line -Beratung.
Generic Levitra Online no prescription.
21 heritage. Viagra wie schnell wirkt rezeptpflichtig wann nehmen online apotheke.
Viagra Online Apotheke Forum United Pharmacy, No Prescription.
Online Apotheke Viagra.
Find our more from our. Erfahrungen Online Apotheke Cialis.
See. Online Apotheke Holland Cialis.
Vipps Certified Online Pharmacy.
Schnelle on-line -Beratung. Viagra Online Apotheke Canada.
Generic Brand Drugs Online, Online Apotheke Vergleich Viagra.
Approved pharmacy. Here is the information you need.
Silagra Kaufen, Online Apotheke, Cellesche Zeitung. Cialis 5mg Online Apotheke, Compare The Best Prices at EUIU Health Care.
Brand-named counterpart because it contains the drug, Sildenafil. Viagra besorgen, sildenafil kosten, Kerncog On-line Apotheke.
Erfahrungen Online Apotheke Cialis. Tadalafil Online Apotheke, High Quality Medications.
Worldwide Shipping, No Prescription Required, FDA Approved Drugs, Fast. 24h.
Cialis Canadian Pharmacy, Online Apotheke Vergleich Viagra.
Sildenafil verkauf С†sterreich kaufen.
Fast order delivery 1-3 days. Beste Online Apotheke Viagra, Best Erectile Dysfunction Cures.
Cialis Online Apotheke Holland. Cialis 5mg Online Apotheke, Medication.
Cialis Apotheke Online.
A Canadian Pharmacy, Online Apotheke Viagra Kaufen. Bonus 10 free pills.
Portofreie Lieferung ab 30 Euro Bestellwert im.
Our Range Of Products Includes.
Effectiveness, satisfaction, ease of use, medication, over the counter, indications. Generika Viagra Online Apotheke, Generic and Brand Viagra.
Billiges Cialis kaufen, cialis keine Verordnung billig, Psipw On-line.
Buy cheap generic drugs online. preisapo.de, Online Apotheke und Versandapotheke.
online apotheke generika Pfizer sildenafil cipla. Preise cialis online С†sterreich, versand deutschland, apotheke sildenafil generika.
Hemangioma oare is fluoxetine in 1:1,000, 1:10,000, and propranolol online.
Preiswertes Viagra, viagra 100mg apotheke, Farma Kanadische. Viagra pille preis sildenafil generika bestellen online Proben Kanada Apotheke.
Viagra Generika Online Apotheke.
Deutsche Online Apotheke Cialis, Get A Second After A Good First.
Test Online Apotheke Viagra, A Pill To Increase Your Libido. Online Apotheke Viagra.
Kanadische Apotheke, Garantiertes Verschiffen.