Discount combination for product discounts through price rule

Shopify Partner
4 0 0

Code given below is to check combination for product discount but its not checking that option on store. Please suggest any change for it, if there is different combination for it


$pricerule_data['title'] = $company_code.'coreactive'.$discount;
$pricerule_data['value'] = (int)$discount_value;
$pricerule_data['value_type'] ="percentage";
$pricerule_data['target_type'] = "line_item";
$pricerule_data['target_selection'] = "all";
$pricerule_data['allocation_method'] = "each";
$pricerule_data['customer_selection'] ='prerequisite';
$pricerule_data['starts_at'] = date('Y-m-d h:i:s');
$pricerule_data['customer_segment_prerequisite_ids'] =[$segment_data['id']];
$pricerule_data['entitled_collection_ids'] = [
$pricerule = $this->store_object->createPriceRule($pricerule_data);

Replies 2 (2)

Shopify Partner
294 14 80

Hi Mamoon26,


I came here from your thread:


It sounds like you're frustrated that you haven't received any answers yet.


My first posts in this forum were met with crickets, which was disheartening, so I can understand where you're coming from.


Part of the reason nobody has replied is because this question lacks context and specifics.


Here are some questions that came to mind while reading this:


  • This is PHP code. Is this code for an app? If so, it wouldn't be possible to help without more information about how the app is built.
  • What is "coreactive"?
  • What is "$segment_data"?
  • Where does the number 291195289653 come from?
  • What specifically are you trying to achieve?
  • What are you expecting to happen, vs. what's actually happening?

The list could go on.


While I can't promise you'll get the exact help you're looking for, I can guarantee that providing all the necessary context and details will make it more likely someone replies.




Shopify Partner
4 0 0

Laravel PHP
coreactive is collection name
segments contains customers, who ever customer contain that segment specific discount will be applied to that customer

291195289653 is collection id

point for this code is to activate product discount combinations in discounts so multiple discounts can be applied in checkout. it works fine when i manually check that option in Product Discounts in combinations, but i want to check this option through code