Skip to content

Instantly share code, notes, and snippets.

@InpsydeNiklas
InpsydeNiklas / gist:fd007cdda4176d4bb2904a333e26d68e
Last active June 29, 2021 11:32
this does something with MLP but I forgot
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);
@InpsydeNiklas
InpsydeNiklas / functions.php
Last active March 7, 2024 01:31
display icon for ppcp-gateway in the checkout
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 );
@InpsydeNiklas
InpsydeNiklas / functions.php
Created May 28, 2021 19:06
make PayPal Card Processing gateway default selection in the checkout
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 );
}
}
@InpsydeNiklas
InpsydeNiklas / Custom CSS
Last active July 6, 2021 15:30
Hide PayPal button on product page only
.product #ppc-button {
display:none
}
@InpsydeNiklas
InpsydeNiklas / functions.php
Last active November 25, 2023 14:24
move PayPal button on product page below add to cart form
add_filter('woocommerce_paypal_payments_single_product_renderer_hook', function() {
return 'woocommerce_after_add_to_cart_form';
});
@InpsydeNiklas
InpsydeNiklas / custom CSS
Created August 20, 2021 08:39
hide Pay Later messaging on product page only
.product #ppcp-messages {
display:none
}
@InpsydeNiklas
InpsydeNiklas / gist:8bf70de406a2ff8afef3aa7c2fcff7ac
Last active February 10, 2022 13:13
List of available hooks for PayPal Payments smart buttons
woocommerce_paypal_payments_checkout_button_renderer_hook
woocommerce_paypal_payments_checkout_dcc_renderer_hook
woocommerce_paypal_payments_pay_order_dcc_renderer_hook
woocommerce_paypal_payments_proceed_to_checkout_button_renderer_hook
woocommerce_paypal_payments_mini_cart_button_renderer_hook
woocommerce_paypal_payments_single_product_renderer_hook
@InpsydeNiklas
InpsydeNiklas / functions.php
Last active July 22, 2022 19:05
MultilingualPress copy post meta GTIN field from Product Feed PRO ELITE
<?php
add_action('multilingualpress.metabox_after_relate_posts', function($context, $request) {
// get post meta value from source site
$ProductFeedELITEGtinValue = (string)$request->bodyValue(
'_woosea_gtin',
INPUT_POST,
FILTER_SANITIZE_STRING
);
@InpsydeNiklas
InpsydeNiklas / functions.php
Last active November 3, 2022 17:56
MultilingualPress - Copy SKU & Price to Product Data tab in the metabox for the remote product(s)
<?php
use Inpsyde\MultilingualPress\TranslationUi\Post\RelationshipContext;
add_action('multilingualpress.metabox_after_update_remote_product',
static function(RelationshipContext $context, WC_Product $remoteProduct, WC_Product $sourceProduct) {
$remoteSku = $remoteProduct->get_sku() ?? '';
$remotePrice = $remoteProduct->get_price() ?? '';
if (!empty($remoteSku) && !empty($remotePrice)) {
return;
@InpsydeNiklas
InpsydeNiklas / functions.php
Created March 25, 2022 01:38
Remove undismissable WooThemes Updater notification: Install/Activate the WooThemes Helper plugin to get updates for your WooThemes plugins.
add_action( 'init', 'remove_woothemes_updater_notice' );
/**
* Remove the undismissable admin notice to install/activate the WooThemes Helper plugin.
*/
function remove_woothemes_updater_notice() {
remove_action( 'admin_notices', 'woothemes_updater_notice' );
}