Skip to content

Instantly share code, notes, and snippets.

View ugurterzi's full-sized avatar
🐢

Ugur Terzi ugurterzi

🐢
View GitHub Profile
@NickGreen
NickGreen / remove_basic_membership_on_purchase.php
Last active April 23, 2019 20:43
Remove basic membership whenever any other membership plan is purchased
<?php
function remove_basic_membership( $plan, $args ) {
// Check that we're purchasing anything other than the basic plan (change number to basic plan id)
if ( 123 !== $plan->id ) {
$memberships = wc_memberships_get_user_memberships( $args['user_id'] );
foreach ( $memberships as $membership ) {
// Check to see if this member has the basic plan
// then delete it if so
@claudiosanches
claudiosanches / custom-my-account-endpoint.php
Last active April 30, 2024 03:05
Example of custom My Account endpoint.
<?php
class My_Custom_My_Account_Endpoint {
/**
* Custom endpoint name.
*
* @var string
*/
public static $endpoint = 'my-custom-endpoint';