Search code examples
phpsilverstripesilvershop

How do I apply a wholesale group price with the Extended Pricing Module?


When using the Extended pricing module I add the following to my YML file.

Product:
  extensions:
    - HasGroupPricing
HasGroupPricing:
  price_levels:
    wholesale: WholesalePrice
  field_labels:
    WholesalePrice: 'Price for wholesale customers'

I have a wholesale group and the fields show up in the CMS for setting a price, but nothing happens on the front end.


Solution

  • The key for the price_levels has to exactly match the Code of the group in the CMS. The Code of a group will only be set with the initial write, so renaming a group later on won't change its group-code!

    That being said, you should inspect the Group Table in your Database and look at the Code column. Identify the group you want to apply the WholesalePrice to and ensure that the key matches the Code of that group…

    Example: You have a Group that is called "My Wholesale Group", the Code of said group is my-group (you'd have to look this up in the Database). You'd then have to change your YML to read:

    HasGroupPricing:
      price_levels:
        # Here's where we change the key to match the Group Code
        my-group: WholesalePrice 
      field_labels:
        WholesalePrice: 'Price for wholesale customers'