For example on my contry, there is 79 states, & there 5 possible shipping method
so, i would create standard shipping rules for all vendors & applied automatically
for example:
I create 5 shipping methods for each states
when vendor from states 1 registred, the 5 shipping methods will applied automatically on his store
& always give hime possibility to add his shipping method
Any developping guide to edit the shipping template code!!
I woud create for example 79 shipping template for each state
When vendor from state 1 registred, the shipping method for state 1 will aplied automatically on his store,
Or option to set same shipping method for many sellers
I’ll simplify it for you
My goal is to prevent sellers from creating their own shipping methods
And I want it to be shipped via the marketplace
But the problem is that the sellers are from different states, and the price varies according to each state
So, through the admin panel, I want to create a shipping method for each state individually.
Now I want to modify the template, and set conditions for how shipping methods appear to customers.
For example, if the seller of the product is from the state of A, only shipping method ID 1 will appear to the customer in the interface
I can recommend you to take a look at the PHP hooks shippings_get_shippings_list_conditions and shippings_get_shippings_list_post. These hooks may be used to filter out the shipping methods that are not suitable for the specific vendor.
now on $vendor_state i will use this php code on shipping_rates
{php}
// Function to retrieve vendor state
function get_vendor_state($auth)
{
$vendor_id = $auth['user_id']; // Assuming the vendor ID is stored in the user_id field
$vendor_info = fn_get_vendor_data($vendor_id); // Replace with the actual function to get vendor data
// Assuming the vendor state is stored in the 'state' field of vendor data
$vendor_state = isset($vendor_info['state']) ? $vendor_info['state'] : '';
return $vendor_state;
}
// Get vendor state for the current vendor
$vendor_state = get_vendor_state($auth);
{/php}