Skip to content

Instantly share code, notes, and snippets.

View KingMatrix1989's full-sized avatar

Roy (KM) KingMatrix1989

  • Netherland
View GitHub Profile
@KingMatrix1989
KingMatrix1989 / memberships-get-rules-sample.php
Created November 22, 2016 09:02 — forked from bekarice/memberships-get-rules-sample.php
memberships: get plan restriction rules, check for product categories
<?php
// get plan restriction rules if we have an ID, could be used in member area for example
$plan = wc_memberships_get_membership_plan( $plan_id );
$product_rules = $plan->get_product_restriction_rules();
foreach ( $product_rules as $rule ) {
// get the ids of restricted items from the rules
$restricted_items = $rule->get_object_ids();