Skip to content

Instantly share code, notes, and snippets.

View KingMatrix1989's full-sized avatar

Karim Mohammadi KingMatrix1989

View GitHub Profile
@KingMatrix1989
KingMatrix1989 / hamster-telegram-web-app.js
Created June 16, 2024 14:38
hamster-telegram-web-app.js
// WebView
(function () {
var eventHandlers = {};
var locationHash = '';
try {
locationHash = location.hash.toString();
} catch (e) {}
var initParams = urlParseHashParams(locationHash);
@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();