Skip to content

Instantly share code, notes, and snippets.

View imth3walrus's full-sized avatar

Juan Sebastian Duque imth3walrus

View GitHub Profile
@troydean
troydean / lgbk_add_member.php
Created March 3, 2014 10:51
WooCommerce Change User Role on Purchase of Specific Product
function lgbk_add_member( $order_id ) {
$order = new WC_Order( $order_id );
$items = $order->get_items();
foreach ( $items as $item ) {
$product_name = $item['name'];
$product_id = $item['product_id'];
$product_variation_id = $item['variation_id'];
}