Learn Tutorials Point - LTP > WordPress > How to Customizing product prices and cart prices in WordPress
How to Customizing product prices and cart prices in WordPress
This code used for Customizing product prices and cart price, and this code add your function.php
file WordPress.
WooCommerce Set Custom Product Price When Adding To Cart – In this product, we’ll see how we can override the price of the product when adding the product into the cart.
<?php add_filter('woocommerce_get_price', 'product_custom_price', 10, 2); function product_custom_price($price, $product) { $custom_price_add = get_post_meta($product->id, 'addprice', true); $custom_price = $product->get_regular_price(); $addprice_new = ($custom_price*$custom_price_add)/100; if(!empty($custom_price_add)){ return $custom_price + $addprice_new; } else { return $custom_price; } } ?>
Author: Learn Tutorials Point
We Well organized and easy-to-understand Interactive tutorials With lots of examples of how to use Tutorials WordPress, PHP, Bootstrap, Bootstrap 4, HTML, CSS, AJAX, jQuery, Woocommerce, Post, Database, Javascript, Theme, Responsive, Templates.
Trending Posts
Tags
ACF
Ading custom columns
admin
Bootstrap
Cart Price
categories
Change Price
class
Code
comments
Create
Creating custom post Type
CSS
current
custom
Customizing
Custom Post
Custom Post Type
Custom Taxonomy
database
Date
Fatch
form
function
HTML
Image
Install
javascript
jQuery
Menu
PHP
Post
Post Type
Price
product
responsive
Resular price
Single product
Table
taxonomy
Theme
Title
woocommerce
Wordpress
Wordpress Code