Skip to content

Instantly share code, notes, and snippets.

/* Display field labels and values in columns */
span.pewc-summary-panel-product-name {
width: 60%;
display: inline-block;
}
span.pewc-summary-panel-product-value {
display: inline-block;
width: 30%;
}
td.pewc-summary-panel-price {
<?php
/**
* Bypass all transients
*/
add_filter( 'pewc_disable_all_transients', '__return_true' );
<?php
add_filter( 'unzip_file_use_ziparchive', '__return_false' );
<html>
<head>
<title>Product Add-Ons Ultimate REST API Tester</title>
</head>
<body>
<script src='wp-includes/js/jquery/jquery.min.js'></script>
<p>API Key: <input type="text" id="wc_api_key" value="" size="50"></p>
<p>API Secret: <input type="text" id="wc_api_secret" value="" size="50"></p>
<p>API Method:
<?php
/**
* Save cancelled roles field for variations
*/
function prefix_save_product_variation( $variation_id, $index ) {
if( isset( $_POST['wcmo_product_sub_cancelled_roles'][$variation_id] ) ) {
update_post_meta( $variation_id, 'wcmo_product_sub_cancelled_roles', $_POST['wcmo_product_sub_cancelled_roles'][$variation_id] );
} else {
delete_post_meta( $variation_id, 'wcmo_product_sub_cancelled_roles' );
<?php
/**
* Filter restriction by page ID for user roles
*/
function prefix_is_restricted_redirect( $is_restricted ) {
$restricted_page_ids = array( 2, 10 );
if( is_page() ) {
$page_id = get_the_ID();
if( in_array( $page_id, $restricted_page_ids ) ) {
<?php
/**
* Restrict access to pages by log-in status
*/
function prefix_is_post_restricted( $is_restricted, $restricted_content ) {
// Edit the page IDs below
$restricted_page_ids = array( 2, 10 );
if( is_page() ) {
$page_id = get_the_ID();
<?php
/**
* Allow more than one booking in the cart
*/
function prefix_max_bookings_in_cart() {
return 99;
}
add_filter( 'bfwc_max_bookings_in_cart', 'prefix_max_bookings_in_cart' );
<?php
/**
* Enable image editing for certain products
*/
function prefix_enable_image_editing( $enabled ) {
$product_id = get_the_ID();
if( in_array( $product_id, array( 123, 456, 789 ) ) ) {
$enabled = 'yes';
}
return $enabled;
<?php
/**
* Fix issue with Divi compatibility
*/
remove_filter( 'sanitize_file_name', 'pewc_rename_uploaded_file' );