wp-e-commerce / WP-e-Commerce

WP eCommerce - The most popular independent eCommerce platform for WordPress
https://wpecommerce.org
GNU General Public License v2.0
215 stars 216 forks source link

Checkout page markup changes in Theme Engine v2 #2297

Open leewillis77 opened 7 years ago

leewillis77 commented 7 years ago

I've just been testing a few of my plugins against the branch-4.0.0 branch, I'm going to raise a few issues, mostly for discussion as there's nothing broken. Please feel free to ignore / close :)

If you have Javascript that attaches to the fields on the checkout page, they can’t be accessed the same way as they are in the existing system. Specifically in my use-case, they no longer have the data-* attributes that they have in the current release, e.g.

<input id="wpsc-checkout-field-billingemail-control" name="wpsc_checkout_details[9]" value="" type="text">

used to be:

<input data-wpsc-meta-key="billingemail" title="billingemail" type="text" id="wpsc_checkout_form_9" class="text wpsc-visitor-meta" placeholder="Email" value="" name="collected_data[9]”>

I’m currently using the data-wpsc-meta-key attribute to attach event handlers to certain fields at checkout. These aren't available in the new theme engine. It looks like each field does have a sensible ID that can be used instead, so it's possible for me to update plugins to look for that as well, but opening this in case you want to consider maintaining the data- attributes for back-compat.

JustinSainton commented 7 years ago

hey @leewillis77

Not opposed at all to adding these data attributes back for unique names if its's helpful for third-party developers.

mihaijoldis commented 7 years ago

we could have it like this data-wpsc-meta-key="wpsc-checkout-field-billingpostcode" if that works. but we should decide if we want to add it for all field types. as in for textfields, selects