This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('wpgens_raf_new_user_referral_id', 'send_referral_to_mailchimp', 10, 2); | |
function send_referral_to_mailchimp($referral_id, $user_id) { | |
$user = get_userdata($user_id); | |
if (!$user) { | |
return; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
document.addEventListener('DOMContentLoaded', function () { | |
document.querySelectorAll('.wpgens-raf-simple-shortcode').forEach(function (el) { | |
el.addEventListener('click', function (e) { | |
e.preventDefault(); | |
const textToCopy = el.href; | |
navigator.clipboard.writeText(textToCopy).then(() => { | |
const originalText = el.textContent; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* RAF & Woocommerce Subscription | |
* | |
* @since 3.0.0 | |
*/ | |
$gens_subs = esc_attr(get_option("gens_raf_subscription")); | |
$is_active = $gens_subs === "1" || $gens_subs === "yes"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('woocommerce_admin_order_data_after_order_details', 'gls_add_pickup_address_select'); | |
function gls_add_pickup_address_select($order) { | |
$selected = $order->get_meta('_gls_pickup_location'); // HPOS-compatible | |
?> | |
<p class="form-field form-field-wide"> | |
<label for="gls_pickup_location"><?php _e('Pickup Location', 'your-textdomain'); ?></label> | |
<select name="gls_pickup_location" id="gls_pickup_location"> | |
<option value="">Default Store Address</option> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Handles all WordPress and WooCommerce hook integrations for the points system | |
*/ | |
class WPGL_Points_Hooks | |
{ | |
private static $instance = null; | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Refer a Friend Product Share Link HTML | |
* | |
* Available variables: $rafLink (Referral link), $share_text(share text option) | |
* | |
* @see https://wpgens.com/docs/how-to-edit-template-files-and-keep-them-after-plugin-update/ | |
* @version 3.2.0 | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Refer a Friend integration with points | |
*/ | |
class WPGL_Refer_A_Friend | |
{ | |
private static $instance = null; | |
public static function init() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
**Custom Point Actions & Integrations** | |
You can add custom point actions by using the `wpgens_loyalty_update_points` action. Here are some examples: | |
```php | |
// Award points for a custom action | |
function award_custom_points($user_id, $points, $description) { | |
do_action( | |
'wpgens_loyalty_update_points', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add meta box to order page | |
add_action('add_meta_boxes', 'add_points_refund_box'); | |
function add_points_refund_box() { | |
if (class_exists('Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController')) { | |
$controller = wc_get_container()->get('Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController'); | |
$screen = $controller->custom_orders_table_usage_is_enabled() | |
? wc_get_page_screen_id('shop-order') | |
: 'shop_order'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'woocommerce_add_to_cart', 'wpgens_auto_apply_coupons_on_add_to_cart', 10, 6 ); | |
function wpgens_auto_apply_coupons_on_add_to_cart( $cart_item_key, $product_id, $quantity, $variation_id, $variation, $cart_item_data ) { | |
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) | |
return; | |
if ( ! is_user_logged_in() ) | |
return; |
NewerOlder