Plugin operation scheme

Order page

  • The plugin adds a shipping method on the checkout page.
  • To work with it, a customer should choose the Yandex Delivery method.
  • Once the shipping method is selected, the customer should fill in mandatory fields on the order page.
  • Choose Shipping Method. This button appears when the customer fills in City.
  • After clicking the Shipping Method button, the customer sees the list of shipping methods: Courier, Pickup, or Mail. The content of the form varies for different shipping methods; shipping services load with prices and delivery time for ordered goods. After clicking Order, the window with shipping methods closes.
  • There is only one step left to place an order – clicking the Confirm order button.

Send data to Yandex Delivery

When the buyer clicks Confirm order, the data is sent to Yandex Delivery by default, and the delivery order is created. You can customize the process and set up an order status when the data will be sent to Yandex Delivery. It means that the data will be sent to Yandex only when the order status in your store’s admin panel changes to the specified value. Here is an example of how you can set up the status:

Data verification in Yandex Delivery

Initially, the order appears as Draft in your Yandex Delivery account. Why is that? Because this way a manager of your store can edit order details (if necessary) after contacting the customer. Once the order details are reviewed or modified, you should save and publish the final order. The final order can’t be changed; only canceled. If the order was canceled accidentally or due to technical difficulties, you can create the order within Yandex Delivery manually. But in this case, the order will not be associated with its original copy in the online store.

If the order status changes to Canceled or the order was moved to trash, the Yandex Delivery copy of it will be marked as Canceled.

An example of how the order looks like in the Yandex Delivery account:

Settings

This section covers settings you need to configure in step 2 after connecting to the Yandex Delivery API.

General settings

Order status for shipping is the status of the order when the order details are being sent to the delivery service. You can change order statuses manually on the order creation/editing page in the admin panel. Example:

Declared value of goods (%) – here you set up the declared value of the goods in the percentage of its real value. The value ranges from 1% to 100%. The declared value affects the amount of the insurance payout if goods were lost or damaged by the fault of the delivery service.

Packaging settings – the package size by default if the product does not have dimensions and weight. The weight and dimensions are set up on the product creation/editing page; Product data -> Delivery. Example:

Shipping Method Settings

You can find delivery methods here: WooCommerce -> Settings -> Shipping -> Shipping zone -> inside any shipping zone (there are no shipping zones by default; you should create them). An example of shipping methods:

To see the shipping method details, add this method inside the shipping zone (see above). Then click Edit below the method name.

Payment on delivery. Select one or several shipping methods holding the CTRL-key. If the customer chooses one of these methods, he or she should pay for the goods and shipping services on delivery. It does not matter whether the shipping method is by a courier or a pickup.

Discount on delivery. Use this option to add a discount on delivery for orders above a certain price. An example:

For developers

Expand conditions for discounts on delivery

We have designed a hook filter so that you or your web developer could create custom conditions for discounts on delivery.

The woocommerce_wbcr_yandex_delivery_cost hook filter takes three parameters:

* Actual shipping cost for the customer;

* Real shipping cost

* Woocommerce Cart

The expected return is float – the new shipping price.

An example of usage. If the number of goods is greater than 10 and the total price is higher than 12,000 rubles; or if the order has a product with ID 11 the delivery cost is zero (free).

/**
* @param float $delivery_cost
* @param float $delivery_real_cost
* @param WC_Cart $cart
*
* @return float
*/
function woocommerce_delivery_cost_sale($delivery_cost, $delivery_real_cost, $cart) {
     if($cart->get_cart_contents_count() > 10 && ((float) $cart->get_cart_total()) > 12000) {
          $delivery_cost = 0.0;
     } else {
          foreach($cart->get_cart() as $cart_item) {
               if($cart_item[‘id’] === 11) {
                    $delivery_cost = 0.0;
                }
           }
     }

     return $delivery_cost;
 }

add_filter(‘woocommerce_wbcr_yandex_delivery_cost’, ‘woocommerce_delivery_cost_sale’, 10, 3);