WooCommerce

<?php

add_filter( 'gettext', 'woocommerce_rename_coupon_field_on_cart', 10, 3 );
add_filter( 'gettext', 'woocommerce_rename_coupon_field_on_cart', 10, 3 );
add_filter('woocommerce_coupon_error', 'rename_coupon_label', 10, 3);
add_filter('woocommerce_coupon_message', 'rename_coupon_label', 10, 3);
add_filter('woocommerce_cart_totals_coupon_label', 'rename_coupon_label',10, 1);
add_filter( 'woocommerce_checkout_coupon_message', 'woocommerce_rename_coupon_message_on_checkout' );


function woocommerce_rename_coupon_field_on_cart( $translated_text, $text, $text_domain ) {
	// bail if not modifying frontend woocommerce text
	if ( is_admin() || 'woocommerce' !== $text_domain ) {
		return $translated_text;
	}
	if ( 'Coupon:' === $text ) {
		$translated_text = 'Voucher:';
	}

	if ('Coupon has been removed.' === $text){
		$translated_text = 'Voucher has been removed.';
	}

	if ( 'Apply coupon' === $text ) {
		$translated_text = 'Apply voucher';
	}

	if ( 'Coupon code' === $text ) {
		$translated_text = 'Voucher';
	
	} 

	return $translated_text;
}


// rename the "Have a Coupon?" message on the checkout page
function woocommerce_rename_coupon_message_on_checkout() {
	return 'Have a voucher?' . ' ' . __( 'Enter your voucher code', 'woocommerce' ) . '';
}


function rename_coupon_label($err, $err_code=null, $something=null){

	$err = str_ireplace("Coupon","Voucher ",$err);

	return $err;
}

?>
add_filter( 'woocommerce_structured_data_product', 'structured_data_product_nulled', 10, 2 );
function structured_data_product_nulled( $markup, $product ){
    if( is_product() ) {
        $markup = '';
    }
    return $markup;
}
add_shortcode( 'product_attribute_list', 'shortcode_product_attribute_list' );
function shortcode_product_attribute_list( $atts ) {
    // Shortcode Attributes
    $atts = shortcode_atts( array(
        'taxonomy'    => 'pa_brand',
        'orderby'     => 'name',
        'hide_empty'  => false, 
    ), $atts, 'product_attribute_list' );

    $terms = get_terms( array(
        'taxonomy'      => $atts['taxonomy'],
        'orderby'       => $atts['orderby'],
        'hide_empty'    => $atts['hide_empty'], 
    ) );

    $html = '<ul class="' . $atts['taxonomy'] . ' brands">';

    // Loop through the taxonomy terms
    foreach( $terms as $term ){
        $html .= '<li><a href="' . get_term_link( $term, $atts['taxonomy'] ) . '">' . $term->name . '</a></li>';
    }

    return $html . '</ul>'; // Return the output
}
function allow_payment_without_login( $allcaps, $caps, $args ) {
    // Check we are looking at the WooCommerce Pay For Order Page
    if ( !isset( $caps[0] ) || $caps[0] != 'pay_for_order' )
        return $allcaps;
    // Check that a Key is provided
    if ( !isset( $_GET['key'] ) )
        return $allcaps;

    // Find the Related Order
    $order = wc_get_order( $args[2] );
    if( !$order )
        return $allcaps; # Invalid Order

    // Get the Order Key from the WooCommerce Order
    $order_key = $order->get_order_key();
    // Get the Order Key from the URL Query String
    $order_key_check = $_GET['key'];

    // Set the Permission to TRUE if the Order Keys Match
    $allcaps['pay_for_order'] = ( $order_key == $order_key_check );

    return $allcaps;
}
add_filter( 'user_has_cap', 'allow_payment_without_login', 10, 3 );

Similiar Collections