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
.ptuwc_table_container table thead tr th, .ptuwc_table_container table tbody tr td { | |
padding-top: 16px; | |
padding-bottom: 16px; | |
} |
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 | |
/** | |
* Filter product if user not logged in | |
*/ | |
function pr_demo_is_purchasable( $purchasable, $product ) { | |
if( !is_user_logged_in() ) { | |
return false; | |
} | |
return $purchasable; | |
} |
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 | |
/** | |
* Filter price for non-logged-in users | |
*/ | |
function pr_demo_get_price_html( $price, $product ) { | |
if( !is_user_logged_in() ) { | |
// Add a custom message here to display instead of the price | |
return __( 'Price on application', 'your_textdomain' ); | |
} | |
return $price; |
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 | |
/** | |
* Hide products with specific IDs | |
* Edit line 7 with the IDs you want to hide prices for | |
*/ | |
add_filter( ‘woocommerce_get_price_html’, function( $price, $product ) { | |
if( is_admin() ) return $price; | |
$product_ids = array( 1234, 5678 ); | |
if( in_array( $product->get_id(), $product_ids ) ) { | |
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
<?php | |
add_filter( ‘woocommerce_get_price_html’, function( $price ) { | |
if ( is_admin() ) return $price; | |
return ”; | |
}); | |
add_filter( ‘woocommerce_cart_item_price’, ‘__return_false’ ); | |
add_filter( ‘woocommerce_cart_item_subtotal’, ‘__return_false’ ); |
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_filter( ‘woocommerce_get_price_html’, function( $price ) { | |
if ( is_admin() ) return $price; | |
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
<?php | |
/** | |
* Exclude child products from coupons | |
*/ | |
add_filter( 'woocommerce_coupon_is_valid_for_product', function( $valid, $product, $coupon, $values ) { | |
if ( ! empty( $values['product_extras']['price_with_extras_discounted'] ) ) { | |
$price = $values['product_extras']['original_price']; | |
$price_discounted = $values['product_extras']['price_with_extras_discounted']; | |
if ( $price != $price_discounted ) { | |
$valid = false; |
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 | |
/** | |
* Ensure that products with user ID permissions override any global settings | |
*/ | |
add_filter( 'wcmo_always_show_user_products', '__return_true' ); |
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 | |
function pewc_ajax_add_child_product_to_cart() { | |
$result = WC()->cart->add_to_cart( intval( $_POST['product_id'] ), intval( $_POST['quantity'] ) ); | |
$result ? wp_send_json_success() : wp_send_json_error(); | |
} | |
add_action('wp_ajax_pewc_add_child_product_to_cart', 'pewc_ajax_add_child_product_to_cart'); | |
add_action('wp_ajax_nopriv_pewc_add_child_product_to_cart', 'pewc_ajax_add_child_product_to_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
<?php | |
/** | |
* Automatically populate a field with user data | |
* Enter the user field in the 'Default' field | |
* Wrapped in {} | |
* E.g. {first_name} | |
*/ | |
function junhee_populate_user_field( $value, $id, $item, $posted ) { | |
if( is_user_logged_in() ) { |