0

We are developoing website in Magento 2.2 and we have specific customer group (BlackCard Membership) for which we have to apply free shipping for all type of orders.

How should I create a new shipping method or shipping rules for this user group so all orders will have free shipping.

Please share the steps or help in this.

Thanks

1

You can add new shipping method by creating new module by following this tutorial, then you can check specific customer group in /Model/Carrier.php like this:

public function __construct(
        ...
        \Magento\Customer\Model\Session $customerSession,
        ...
    ) {
        ...
        $this->_customerSession = $customerSession;
        ...
    }

public function collectRates(RateRequest $request){
    ...
    //get customer group id
    $customerGroup = $this->_customerSession->getCustomer()->getGroupId();
    if($customerGroup == 'X' || $customerGroup == 'Y'){
       $method->setPrice('0');
       $method->setCost('0');
    }
    ...
}
| improve this answer | |
0

You should create a cart rule for free shipping method, to do this follow below steps:

  1. Login to admin, Go to Marketing->Cart Price Rules
  2. Create a new cart rule by selecting the preferred customer group, in your case "BlackCard Membership"
  3. Now complete the configuration for freeshipping rule as below:
    • Enter a Rule Name for internal reference
    • Enter a brief Description to describe the rule
    • Set Status to “Active.”
    • Set Website to “Main Website.” (Click to make sure the entry is selected.)
    • Select the Customer Groups to which the rule applies
    • Set Coupon to one of these following: – To offer a free shipping promotion without a coupon, accept the default, “No Coupon” setting.
  4. In the panel on the left, choose Actions. Then under Pricing Structure Rules, do the following:
    • Set Apply to “Percent of product price discount.”
    • Set Apply to Shipping Amount to “Yes.”
    • Set Free Shipping to “For shipment with matching items.
    • In the panel on the left, choose Labels. Then, do one of the following: a. Enter a Default Rule Label for All Store Views. This label is visible to the customer. b. If your store is available in multiple stores, enter Store View Specific Labels for each view. Tap Save Rule.
  5. Test The Rule

Note :

When you create a new price rule, it might take an hour or so to become available. Make sure to allow enough time for it to get into the system. Then, test the rule to make sure that it works correctly.

Hope that you can apply for your site easily.

| improve this answer | |
0

I have created simple shopping cart rule with test and restrict this rule to only retailer customer with free shipping.

Please check below screenshot enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.