Skip to content

Instantly share code, notes, and snippets.

@seostudio
seostudio / functions.php
Created January 5, 2018 11:50
allegro_shortcode_wpautop
add_filter( 'allegro_shortcode_wpautop', '__return_true' );
@seostudio
seostudio / functions.php
Created January 5, 2018 11:50
allegro_shortcode_wpautop
add_filter( 'allegro_shortcode_wpautop', '__return_true' );
@seostudio
seostudio / functions.php
Created January 9, 2018 09:45
dequeue jquery-ui-style
function my_dequeue_css() {
wp_dequeue_style( 'jquery-ui-style' );
}
add_action( 'admin_enqueue_scripts', 'my_dequeue_css', 100 );
@seostudio
seostudio / functions.php
Last active January 17, 2018 09:45
flexible_checkout_fields_validate_billing_test_validate
<?php
add_action( 'flexible_checkout_fields_validate_billing_test_validate', 'flexible_checkout_fields_validate_billing_test_validate' );
function flexible_checkout_fields_validate_billing_test_validate( $value ) {
if ( $value != '1' ) {
wc_add_notice( 'Test validate must equals 1!', 'error' );
}
}
@seostudio
seostudio / functions.php
Last active March 12, 2019 15:59
woocommerce_form_field_args
add_filter( 'woocommerce_form_field_args', 'my_woocommerce_form_field_args', 10, 3 );
function my_woocommerce_form_field_args( $args, $key, $value ) {
if ( $args['type'] == 'checkbox' ) {
$args['label'] = '<span>' . $args['label'] . '</span>';
}
return $args;
}
@seostudio
seostudio / custom-thankyou.php
Created January 16, 2018 11:10
ceneo-trusted-reviews - custom thank you page Raw
<?php do_action( 'woocommerce_thankyou', $order_id ); ?>
@seostudio
seostudio / custom-thankyou.php
Created January 16, 2018 11:10
ceneo-trusted-reviews - custom thank you page Raw
<?php do_action( 'woocommerce_thankyou', $order_id ); ?>
@seostudio
seostudio / functions.php
Last active January 19, 2018 17:10
Prefix in woocommerce order number
add_filter( 'woocommerce_order_number', 'wpdesk_woocommerce_order_number_prefix_suffix', 20 );
function wpdesk_woocommerce_order_number_prefix_suffix( $order_id ) {
$prefix = 'X/';
$suffix = '/Y';
$new_order_id = $prefix . $order_id . $suffix;
return $new_order_id;
}
@seostudio
seostudio / functions.php
Created September 28, 2020 15:11
Hide out of stock products in woocommerce related products
<?php
class WPDeskHideOutOfStockInRelated {
public function hooks() {
add_action( 'woocommerce_after_single_product_summary', array( $this, 'add_filter' ), 19 );
add_action( 'woocommerce_after_single_product_summary', array( $this, 'remove_filter' ), 21 );
}
public function add_filter() {