Skip to content

Instantly share code, notes, and snippets.

@gamaup
Last active April 2, 2018 03:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gamaup/e139586d65b741f1fe8bb9aba9c6f865 to your computer and use it in GitHub Desktop.
Save gamaup/e139586d65b741f1fe8bb9aba9c6f865 to your computer and use it in GitHub Desktop.
Custom Price Rules data structure
<?php
$rules = array(
"ruleset_f45Is7PCFWd4mjU" => array(
"label" => "Ruleset Name",
"enabled" => true,
"rules" => array(
"rule_mVk9lHtMJLw38vD" => array(
"label" => "Rule Name",
"method" => "bulk",
"rewards" => array(
"bulk-discount" => array(
array(
"from" => 1,
"to" => 2,
"type" => "fixed_discount",
"amount" => 1000
),
array(
"from" => 3,
"to" => ,
"type" => "fixed_discount",
"amount" => 2000
)
)
),
"restrictions" => array(
"product" => array(
array(
array(
"param" => "id"
"operator" => "in_list"
"value" => array(
2469
)
)
)
)
)
)
),
"is_exclusive" => false
)
)
<?php
$rules = array(
// rule 1,
"rule_H1HpHSlUMxw4bHN" => array(
"method" => "bulk", // method.
"rewards" => array( // rewards.
"bulk-pricing" => array(
array(
"from" => 1,
"to" => 2,
"price" => 90000
),
array(
"from" => 3,
"to" => 4,
"price" => 80000
),
array(
"from" => 5
"to" =>
"price" => 70000
)
)
),
"restrictions" => array( // restrictions.
"condition" => array(
array( // or clause.
array( // and clause.
"param" => "reseller_type",
"operator" => "in_list",
"value" => array(
"all"
)
)
)
)
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment