Y
Y
Yan Aleksandrov2020-12-31 10:50:45
WooCommerce
Yan Aleksandrov, 2020-12-31 10:50:45

How to add payment methods to WooCommerce?

On the Checkout page, when you select "Region \ district" (read regions), the data of delivery methods changes. Methods are attached to zones by their ID and set in the admin panel (WooCommerce shipping settings). This is how WC works.
Through the woocommerce_states filter, their regions with their identifiers are added. I create the North zone. Then I attach the Severouralsk region with the SVK identifier to the "North" zone. The delivery method is attached to the same zone - Free for orders over 100 rubles. At this stage, the methods are loaded correctly, according to the region.
I connect a third-party plug-in SDEK. It overrides the "Province\District" field and adds zones with their IDs. It turns out that Severouralsk becomes with ID 123.
The problem is that only methods from CDEK remain in the delivery methods, and those created from WooCommerce disappear.
What I tried:
1. Set identifiers for regions, as from CDEK. But, unfortunately, it didn't help.
2. Through the "woocommerce_checkout_update_order_review" action, update the list of available payment methods. It has a post_data variable that stores the region id from CDEK. I got to the point where I get the delivery methods I need. That is, when receiving the region ID from CDEK (123), I can get the delivery methods attached to the SVK ID. But stuck on how to add them to the list on the Checkout page.
Hope the community can help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
noxplex, 2020-01-01
@noxplex

Find a plugin for this.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question