January, 2016

By In Magento

Onestepcheckout does not work with shipping coupon fix

Default Magento checkout process can be quite boring, because customer need to enter data in steps. After finishing one step customer need to press button to proceed to next step and in case that he want to change something in previous steps he will need to repeat process. That is why ‘one-page’ and ‘one-step’ checkout modules are popular, they allow customer to enter all data on one screen with additional option to populate fields in custom order.

Magestore developed solid ‘One Step Checkout’ however I run into a bug that was quite disappointing. Our idea was to enable free shipping when customers enter coupon code, to complicate things a bit more store was already using Matrix Rates party shipping method modules. Issue occur when customer enter promo code, ‘One Step Checkout’ reload several blocks however shipping methods stay same and new fees are not calculated properly.

I contacted Magestore support but they didn’t replied to my question, also I found topic about same issue on there forum but without answers (just few spam posts).

Due lack of time I wanted to fix issue with minimal changes on module, in case that we decide to update plugin and issue is still present in next version.
Open java script file located in folder:

find function that add coupon add_coupon_code and in Ajax onSuccess event add this line of code: location.reload(true);

that part of function should look like this:
onSuccess: function (transport) {
var response = getResponseText(transport);
if (response.error) {
else {
save_shipping_method(shipping_method_url, 1, 1);

repeat same for function that remove coupon remove_coupon_code.

Save file and test new setup, on checkout page enter coupon code and hit ‘Apply coupon’ button, if code is valid page will reload and shipping methods will be properly updated (including fees, which was main issue). Since this small hack is opposite form ‘One Step Checkout’ idea to use AJAX and keep customer on page without reloading I asked few friends to test complete setup. Coupon code was positioned just above ‘Place order’ button so reloading page didn’t disturbed much there shopping experience.

Read more