Skip to content

Instantly share code, notes, and snippets.

View PluginRepublicSupport's full-sized avatar

PluginRepublicSupport

View GitHub Profile
<?php
function prefix_pewc_products_for_cats_limit($limit) {
// Increase the limit to 120
$limit = 120;
return $limit;
}
add_filter('pewc_products_for_cats_limit', 'prefix_pewc_products_for_cats_limit');
<?php
add_filter( 'apaou_layer_parent', function() {
return 'woocommerce-product-gallery__image';
} );
@PluginRepublicSupport
PluginRepublicSupport / wcraq_bfwc_compatibility.php
Last active June 21, 2023 09:21
Compatibility between Bookings for WooCommerce and WooCommerce Request a Quote. Requires RAQ version >= 1.0.12
<?php
/**
* Add booking metadata to quote item (Bookings for WooCommerce)
*/
function wcraq_bfwc_custom_order_item_meta( $item_id, $cart_item, $cart_id ) {
if ( ! empty( $cart_item['booking'] ) ) {
wc_add_order_item_meta( $item_id, 'booking', $cart_item['booking'], true );
}
}
add_action( 'wcraq_custom_order_item_meta', 'wcraq_bfwc_custom_order_item_meta', 10, 3 );
@PluginRepublicSupport
PluginRepublicSupport / pewc_custom_update_quantity_value.php
Created June 20, 2023 08:57
For Add-Ons Ultimate. Pass back to the product page the quantity in the cart when editing add-ons
<?php
/**
* For Add-Ons Ultimate. Pass back to the product page the quantity in the cart when editing add-ons
*/
add_filter( 'woocommerce_quantity_input_args', 'pewc_custom_update_quantity_value', 11, 2 );
function pewc_custom_update_quantity_value( $args, $product ) {
if ( ! function_exists( 'pewc_user_can_edit_products' ) ) {
return $args;
}
@PluginRepublicSupport
PluginRepublicSupport / pewc_wcmmqt_custom_default_quantity.php
Last active June 20, 2023 08:58
For Min Max Quantity Order. Pass back to the product page the value of the quantity in the cart when editing add-ons
<?php
/**
* For Min Max Quantity Order. Pass back to the product page the value of the quantity in the cart when editing add-ons
*/
add_filter( 'wcmmqt_default_quantity', 'pewc_wcmmqt_custom_default_quantity', 11, 2 );
function pewc_wcmmqt_custom_default_quantity( $default_quantity, $product ) {
if ( ! function_exists( 'pewc_user_can_edit_products' ) ) {
return $default_quantity;
}
@PluginRepublicSupport
PluginRepublicSupport / bookign_table_heading.php
Created June 15, 2023 12:25
Booking Table Table Headers
<?php
function change_booking_text( $translated_text, $text, $domain ) {
if ( $domain === 'bfwc' ) {
switch ( $text ) {
case 'Quantity:':
$translated_text = 'Word1:';
break;
case 'Duration:':
$translated_text = 'Word2:';
@PluginRepublicSupport
PluginRepublicSupport / table_column_headers.php
Created June 13, 2023 12:28
Product Table Column Header
function modify_price_with_jquery() {
wp_add_inline_script('jquery-core', '
jQuery(document).ready(function($) {
$(".ptuwc-thumbnail").text("Visual");
});
');
}
add_action('wp_enqueue_scripts', 'modify_price_with_jquery');
@PluginRepublicSupport
PluginRepublicSupport / show_checkbox_pewc.css
Created June 7, 2023 15:51
Show Checkbox in Image Box
.pewc-radio-image-wrapper label input[type=radio], .pewc-checkbox-image-wrapper label input[type=checkbox] {
visibility: initial;
}
.pewc-preset-style .pewc-item-field-wrapper input[type="checkbox"], .pewc-preset-style input[type="checkbox"].pewc-checkbox-form-field{
opacity: 1;
height: 10px;
position: relative;
}
@PluginRepublicSupport
PluginRepublicSupport / no_rounding_dicount.php
Created June 7, 2023 15:44
Don't Round Discounted Prices
<?php
/** Don't round discounts prices - instead 2 decimal places **/
function custom_adjusted_price( $adjusted_price ) {
$formatted_price = number_format( $adjusted_price, 2, '.', '' );
return $formatted_price;
}
@PluginRepublicSupport
PluginRepublicSupport / optional_form_fields.php
Created June 6, 2023 13:32
Request Quote Fields Optional
<?php
function optional_quote_fields( $fields ) {
/** Make fields not required **/
$fields['phone']['required'] = false;
$fields['email']['required'] = false;
return $fields;