Hello,
I am looking for some help with modifying my product page using wordpress hooks and functions.php. I am looking to do two things
I would like to hook this code to display below the add to cart button with following condiitons:
If product in category "sneakers" output this code
Return Policy: Returns accepted if product does not fit, buyer pays return shipping fee

else output this code

I already have a hook in my functions.php that I think is not letting me add more hooks below add to cart. I have added my functions file below and I am using the storefront theme.
Thank you
VERIFIED BUYER';
}
add_filter( 'woocommerce_product_tabs', 'reordered_tabs', 98 );
function reordered_tabs( $tabs ) {
$tabs['reviews']['priority'] = 5;
$tabs['description']['priority'] = 10;
return $tabs;
}
/** Remove product data tabs **/
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
function woo_remove_product_tabs( $tabs ) {
unset( $tabs['additional_information'] ); // Remove the additional information tab
return $tabs;
}
/** Shipping and Returns product tab **/
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {
// Adds the new tab
$tabs['shipreturns'] = array(
'title' => __( 'Shipping and Returns', 'woocommerce' ),
'priority' => 15,
'callback' => 'woo_new_product_tab_content'
);
return $tabs;
}
function woo_new_product_tab_content() {
// The new tab content
echo 'Shipping Information';
echo '
U.S.A. Shipping: All orders over $75 qualify for free shipping! For all orders under $75 shipping fee is $5.99
Shipping Time: 4-12 days
Order Processing: 24-72 hours
We use DHL, UPS, and USPS for delivery. In the event that your item is out of stock in our USA warehouse we will ship from our international warehouses in U.K. or China. In this case please allow 2 days of extra processing time for your order.
International Shipping: Canada, Australia, United Kingdom, Canada, Israel, Norway, France, Brazil, Spain, Netherlands, Denmark, Germany, Mexico, South Africa, Sweden
International Shipping cost: $6.99.
Shipping Time: 8-15 days
Order Processing: 24-72 hours
Important Note: Some customers may have to pay a customs fee on their products upon arrival of their country. This isn’t exclusively a shipping issue but an international shipping one. We are not responsible for any fee you my incur.
';
echo 'Returns and Exchanges';
echo 'We provide hassle free easy returns. You have 7 days from the day you received your items to review, and if necessary, request an exchange. Your package must not be post marked any later than 7 days from the delivery date.
Using our returns/exchange form you can quickly request a return. It is your responsibility to return the item(s) to Bright LED Shoes and pay for shipping cost. After inspection we will send you an exchange. All sales are final and we do not refund sale or clearance items. Click here to view full return policy ';
}
/** Buyer Guarantee tab **/
function woo_new_product_tab_warranty( $tabs ) {
// Adds the new tab
$tabs['warranty'] = array(
'title' => __( 'Buyer Guarantee', 'woocommerce' ),
'priority' => 30,
'callback' => 'woo_new_product_tab_warranty_content'
);
return $tabs;
}
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab_warranty' );
function woo_new_product_tab_warranty_content() {
// The new tab content
echo 'Safe and secure purchase';
echo 'Bright LED Shoes is committed to providing our customers with high quality products. Shop safely and secure knowing all of our light up shoes batteries come backed by a 30 day warranty. Warranty is effective on the date of purchase.Our warranty covers the battery that powers our led shoes. If your lights are no longer working you can submit a return request using our form. You will then be sent instructions to test your shoes to confirm the battery is the cause of the issue. If we determine that is the case we will send you a replacement battery which you can easily insert into your shoes. ';
}
function my_text_based_on_geolocation(){
// Geolocation must be enabled @ Woo Settings
$location = WC_Geolocation::geolocate_ip();
$country = $location['country'];
// Lets use the country to e.g. echo greetings
switch ($country) {
case "US":
$hello = '
Shipping: Fast Shipping to United States
Estimated Delivery Time: 7-12 days ';
break;
case "CA":
$hello = '
Shipping: Fast Shipping to Canada
Estimated Delivery Time:8-15 days ';
break;
case "UK":
$hello = '
Shipping: Fast Shipping to United Kingdom
Estimated Delivery Time:8-15 days ';
break;
case "AU":
$hello = '
Shipping: Fast Shipping to Australia
Estimated Delivery Time:8-15 days ';
break;
default:
$hello = '
Shipping: Fast Shipping
Estimated Delivery Time:8-15 days ';
}
echo $hello;
}
add_action( 'echo_geolocation_text', 'my_text_based_on_geolocation' );
add_action( 'woocommerce_after_add_to_cart_button', 'add_content_after_addtocart_button_func' );
function add_content_after_addtocart_button_func() {
// Echo content.
echo do_action( 'echo_geolocation_text' );
}
Solution - 1
Try adding this code into your existing add_content_after_addtocart_button_func()
if ( is_product() && has_term( 'sneakers', 'product_cat' ) ) {
echo 'Return Policy: Returns accepted if product does not fit, buyer pays return shipping fee
';
}
else echo ' ';
Solution - 2
Hello George,
Could you send me your site url and wp admin login info to my email
[email protected]
I knew the concept of your needs and I have the solution
Solution - 3
Please show me your site.
|