Skip to content

Instantly share code, notes, and snippets.

View ahmedeshaan's full-sized avatar

Ahmed Eshaan ahmedeshaan

View GitHub Profile
add_filter('gettext', 'change_rp_text', 10, 3);
add_filter('ngettext', 'change_rp_text', 10, 3);
function change_rp_text($translated, $text, $domain)
{
if ($text === 'Related products' && $domain === 'woocommerce') {
$translated = esc_html__('Check out our other products', $domain);
}
return $translated;
}
function woocommerce_registration_errors_validation($reg_errors, $sanitized_user_login, $user_email) {
global $woocommerce;
extract( $_POST );
if ( strcmp( $password, $password2 ) !== 0 ) {
return new WP_Error( 'registration-error', __( 'Passwords do not match.', 'woocommerce' ) );
}
return $reg_errors;
}
add_filter('woocommerce_registration_errors', 'woocommerce_registration_errors_validation', 10, 3);
if ( ! function_exists( 'woocommerce_template_loop_product_title' ) ) {
/**
* Fix WooCommerce Loop Title
*/
function woocommerce_template_loop_product_title() {
echo '<h3 class="name product-title ' . esc_attr( apply_filters( 'woocommerce_product_loop_title_classes', 'woocommerce-loop-product__title' ) ) . '">';
woocommerce_template_loop_product_link_open();
echo get_the_title(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
woocommerce_template_loop_product_link_close();
echo '</h3>';
https://nl.wordpress.org/plugins/definitely-allow-mobile-zooming/
function bb_wvs_support(){
if(class_exists('FLThemeBuilderLoader')):
if (is_shop()):
add_action( 'fl_builder_post_grid_after_content', 'wvs_pro_archive_variation_template', 7 );
endif;
endif;
}
add_action('wp', 'bb_wvs_support');
<?php
add_filter( 'jet-woo-builder/template-functions/product-price', 'get_wvs_pro_archive_variation_template', 999, 1 );
function get_wvs_pro_archive_variation_template( $html ) {
if ( is_product_taxonomy() || is_post_type_archive( 'product' ) || is_page( wc_get_page_id( 'shop' ) ) ) {
$wvs_archive_variation_template = wvs_pro_archive_variation_template();
$html .= $wvs_archive_variation_template;
return '<div class="price">' . $html . '</div>';
<?php
add_filter( 'jet-woo-builder/template-functions/product-add-to-cart-settings', 'wvs_pro_archive_variation_button_args', 999, 2 );
function wvs_pro_archive_variation_button_args( $args ) {
global $product;
$product = wc_get_product();
$ajax_add_to_cart_enabled = 'yes' === get_option( 'woocommerce_enable_ajax_add_to_cart' );
function wd_tiny_cart_wpml_page_id($page_id) {
global $sitepress;
if ($sitepress && has_filter('wpml_object_id')) {
$pageId = apply_filters('wpml_object_id', $page_id, 'page', true, $sitepress->get_current_language());
}
return $pageId;
}
add_filter('woocommerce_get_cart_page_id', 'wd_tiny_cart_wpml_page_id');
add_filter('woocommerce_get_checkout_page_id', 'wd_tiny_cart_wpml_page_id');
function wvs_halena_theme_support() {
add_action( 'woocommerce_shop_loop_item_title', 'wvs_pro_archive_variation_template', 10 );
}
add_action( 'init', 'wvs_halena_theme_support' );
add_action( 'init', function () {
remove_action( 'woocommerce_after_shop_loop_item', 'wvs_pro_archive_variation_template', 30 );
remove_action( 'woocommerce_after_shop_loop_item', 'wvs_pro_archive_variation_template', 7 );
add_action( 'astra_woo_shop_price_after', 'wvs_pro_archive_variation_template', 9, 0 );
} );