Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Add to cart, link to product page

// First, remove Add to Cart Button
add_action( 'after_setup_theme', 'my_remove_add_to_cart', 99 );
function my_remove_add_to_cart() {
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );    
}

// Second, add View Product Button
add_action( 'woocommerce_after_shop_loop_item', 'bbloomer_view_product_button', 10 );
function bbloomer_view_product_button() {
    global $product;
    $link = $product->get_permalink();
    echo '<a href="' . $link . '" class="button addtocartbutton">View Product</a>';
}
Comment

PREVIOUS NEXT
Code Example
Php :: withcookie function in php 
Php :: laravel update method 
Php :: laravel 8 livewire tutorial 
Php :: delete laravel error log 
Php :: php header author 
Php :: query log laravel 
Php :: PHP If If Else Else Statement 
Php :: remove field from object php 
Php :: delete a migration laravel 
Php :: generate a unique id 
Php :: What template files are used for our custom post type in wordpress? 
Php :: php print 
Php :: wherebetween laravel 
Php :: php monolog 
Php :: laravel Pushing To Array Session Values 
Php :: wordpress wp_nav_menu custom id 
Php :: sage theme 
Php :: how to convert an array to uppercase before storing in database 
Php :: infinite loop php 
Php :: laravel echo 
Php :: reset admin password magento 2 
Php :: php constants 
Php :: In PackageManifest.phpIn PackageManifest.php line 122: Undefined index: name line 122: Undefined index: name 
Php :: get data in php 
Php :: php strings 
Php :: how to add drop a table in phpmyadmin 
Php :: router php 
Php :: php mvc example 
Php :: php convert dbf to mysql 
Php :: How to find data in other row with laravel-excel 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =