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
/** * Allow SVG uploads for administrator users. * * @param array $upload_mimes Allowed mime types. * * @return mixed */ add_filter( ‘upload_mimes’, function ( $upload_mimes ) { // By default, only administrator users are allowed to add SVGs. //…Continue reading
add_filter( ‘login_head’, function () { // Update the line below with the URL to your own logo. // Adjust the Width & Height accordingly. $custom_logo = ‘https://westlinemarketing.com/wp-content/uploads/2024/11/Westline-Horiz.-Logo-dark-Bl-Gr-Wh.svg’; $logo_width = 300; $logo_height = 100; printf( ‘ ‘, $custom_logo, $logo_width, $logo_height );…Continue reading
http://bucketvisualizadorvplant.s3-website-us-east-1.amazonaws.com/practicas/Bombas-centr%C3%ADfugasContinue reading
/** * Approve user after PayPal payment status is Complete * * @link https://wpforms.com/developers/how-to-approve-a-user-after-a-paypal-payment/ */ function wpf_dev_activate_user_after_paypal_complete( $fields, $form_data, $payment_id, $data ){ // Add the field ID for the user’s account email $email_field = 3; // Stop editing $user =…Continue reading
add_filter( ‘woocommerce_cart_item_price’, ‘filter_cart_item_price’, 10, 3 ); function filter_cart_item_price( $price_html, $cart_item, $cart_item_key ) { if( $cart_item[‘data’]->is_on_sale() ) { return $cart_item[‘data’]->get_price_html(); } return $price_html; } add_filter( ‘woocommerce_cart_item_subtotal’, ‘filter_cart_item_subtotal’, 10, 3 ); function filter_cart_item_subtotal( $subtotal_html, $cart_item, $cart_item_key ){ $product = $cart_item[‘data’]; $quantity =…Continue reading
add_action( ‘woocommerce_after_shop_loop_item’, ‘wc_loop_get_product_stock_availability_text’, 10 ); function wc_loop_get_product_stock_availability_text() { global $wpdb, $product; // For variable products if( $product->is_type(‘variable’) ) { // Get the stock quantity sum of all product variations (children) $stock_quantity = $wpdb->get_var(” SELECT SUM(pm.meta_value) FROM {$wpdb->prefix}posts as p JOIN…Continue reading
add_action( ‘woocommerce_check_cart_items’, ‘required_min_cart_subtotal_amount’ ); function required_min_cart_subtotal_amount() { // HERE Set minimum cart total amount $minimum_amount = 250; // Total (before taxes and shipping charges) $cart_subtotal = WC()->cart->subtotal; // Add an error notice is cart total is less than the minimum…Continue reading
// Display notice on single product page for specific category add_action(‘woocommerce_before_single_product_summary’, ‘display_category_notice’); function display_category_notice() { global $product; if (!$product) { return; // Exit if $product is not defined } $categories = get_categories_with_minimum_amount(); $cart_items = WC()->cart->get_cart(); $notices = array(); foreach ($categories…Continue reading
add_action(‘woocommerce_order_status_pending’, ‘woo_schedule_cancel_order_event’); function woo_schedule_cancel_order_event($order_id) { if (!wp_next_scheduled(‘woo_cancel_pending_order’, array($order_id))) { wp_schedule_single_event(time() + 3600, ‘woo_cancel_pending_order’, array($order_id)); } } add_action(‘woo_cancel_pending_order’, ‘woo_cancel_order’); function woo_cancel_order($order_id) { $order = wc_get_order($order_id); wp_clear_scheduled_hook(‘woo_cancel_pending_order’, array($order_id)); if ($order && $order->has_status(‘pending’)) { $order->update_status(‘cancelled’, ‘Pending order cancelled after 1 hour’); } }Continue reading