Show Terms By Default (copy)

function sumobi_edd_show_terms_agreement() { global $edd_options; /*print_r($edd_options);*/ if ( isset( $edd_options[‘show_agree_to_terms’] ) ) { ?> <?php } } remove_action( 'edd_purchase_form_before_submit', 'edd_terms_agreement' ); add_action( 'edd_purchase_form_before_submit', 'sumobi_edd_show_terms_agreement' );Continue reading

WooCommerce: Restrict Shipping Methods by User Role (Logged In, Logged Out, Custom Roles)

// 💡 Load multiselect field to all shipping methods add_action(‘woocommerce_init’, ‘woocommerce_shipping_instances_form_fields_filters’); function woocommerce_shipping_instances_form_fields_filters() { foreach (WC()->shipping->get_shipping_methods() as $shipping_method) { add_filter(‘woocommerce_shipping_instance_form_fields_’ . $shipping_method->id, ‘add_allowed_roles_field_to_shipping_methods’); } } // 🎯 Add multiselect role option (styled like tag input) function add_allowed_roles_field_to_shipping_methods($settings) { $settings[‘allowed_user_roles’] =…Continue reading

WooCommerce | Add currency below Total at checkout

function add_currency_below_total() { $currency = get_woocommerce_currency(); // Get currency code (e.g., USD, CAD, EUR) echo ‘ ‘ . __(‘Currency’, ‘woocommerce’) . ‘ ‘ . esc_html($currency) . ‘ ‘; } add_action(‘woocommerce_review_order_after_order_total’, ‘add_currency_below_total’);Continue reading

Split Full Name at Checkout

document.addEventListener(‘DOMContentLoaded’, function () { // Select the First Name field var firstNameField = document.querySelector(‘#billing_first_name’); var lastNameField = document.querySelector(‘#billing_last_name’); if (firstNameField) { firstNameField.addEventListener(‘change’, function () { var fullName = firstNameField.value.trim(); var nameParts = fullName.split(‘ ‘); // Extract First Name and Last…Continue reading

Prevent Duplicate Purchases

function pw_edd_prevent_duplicate_purchase( $valid_data, $posted ) { $cart_contents = edd_get_cart_contents(); foreach( $cart_contents as $item ) { if( edd_has_user_purchased( get_current_user_id(), $item[‘id’] ) ) { edd_set_error( ‘duplicate_item’, ‘You have already purchased this item so may not purchase it again’ ); } } }…Continue reading