It is not difficult to make two copies of the Omniva shipping method and call them _M and _L and then give the three methods three different prices
In “estonian-shipping-methods-for-woocommerce.php” it should look like this around line 50 or so:
// Omniva.
'WC_Estonian_Shipping_Method_Omniva_Parcel_Machines_EE' => false,
'WC_Estonian_Shipping_Method_Omniva_Parcel_Machines_EE_M' => false,
'WC_Estonian_Shipping_Method_Omniva_Parcel_Machines_EE_L' => false,
Further down around line 130 it looks like this:
require_once WC_ESTONIAN_SHIPPING_METHODS_INCLUDES_PATH . '/methods/class-wc-estonian-shipping-method-omniva-parcel-machines-ee.php';
require_once WC_ESTONIAN_SHIPPING_METHODS_INCLUDES_PATH . '/methods/class-wc-estonian-shipping-method-omniva-parcel-machines-ee-m.php';
require_once WC_ESTONIAN_SHIPPING_METHODS_INCLUDES_PATH . '/methods/class-wc-estonian-shipping-method-omniva-parcel-machines-ee-l.php';
The second two lines you see link to a copy of the file in the first line. In the two copies you need to change the names accordingly, like this for size L:
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Omniva parcel machines shipping method
*
* @class WC_Estonian_Shipping_Method_Omniva_Parcel_Machines_EE
* @extends WC_Estonian_Shipping_Method
* @category Shipping Methods
* @package Estonian_Shipping_Methods_For_WooCommerce
*/
class WC_Estonian_Shipping_Method_Omniva_Parcel_Machines_EE_L extends WC_Estonian_Shipping_Method_Omniva {
/**
* Class constructor
*/
function __construct() {
// Identify method
$this->id = 'omniva_parcel_machines_ee_l';
$this->method_title = __( 'Omniva Estonia L', 'wc-estonian-shipping-methods' );
// Construct parent
parent::__construct();
$this->country = 'EE';
}
}
Back in the WooCommerce shipping setting you give each of the three Omniva methods the desired price. You now need to use a plugin to select the appropriate shipping method for each shipping class. Meaning, if the shipping class of your order is “Medium” you need to hide S and L so the customer can only select M. I use “WooCommerce Conditional Shipping and Payments”. This could probably also be done with a filter, but I don’t know how.