Added README

This commit is contained in:
jacob.eva 2023-05-18 12:43:54 +01:00
parent cdb81a2853
commit a344f695ed
No known key found for this signature in database
GPG Key ID: 0B92E083BBCCAA1E

23
README.md Normal file
View File

@ -0,0 +1,23 @@
# Woocommerce - JS-free variation shopping
## Why?
Variable products in Woocommerce have variable IDs, which are used server side
to add the correct product variant to the user's cart. Unfortuntely, these are
sent in the form through the use of JQuery, which requires Javascript.
Incredibly cringe.
Therefore, I decided to create a solution which allows for users to still shop,
without enabling or supporting Javascript in their browser.
## How?
Firstly, this plugin hooks the add-to-cart handler to modify the string
returned for variable products, so that a custom action is called to handle
them, rather than the default behaviour.
This custom action then collects the attributes and product ID the user sent in
their request and constructs an SQL query to retrieve the correct variation ID
for the attributes the user selected (prepared statements so you don't get RCE
by accident LOL). Then, this is used to add the correct product variation to the
cart, and finally redirects the user to the basket page after.
# Hey goy, I found a hecking bug!
Email me at `jacob.eva@liberatedsystems.co.uk` and I'll investigate.