Last active
February 6, 2019 17:58
-
-
Save mahbubme/989466b22142d7cba936edfcbf4308a7 to your computer and use it in GitHub Desktop.
Update product price of WooCommerce based on different conditions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function update_price_wpuf_form( $post_id ) { | |
$boolChifre = isset( $_POST['pa_chifre'] ) ? $_POST['pa_chifre'] : 0; | |
$currentPrice = get_post_meta( $post_id, '_regular_price' ); | |
$images = get_post_meta( $post_id, '_product_image' ); | |
$images = count($images); | |
if ( $images > 2 ) { | |
$currentPrice = 35; | |
} | |
if( $boolChifre == 62) { | |
$regular_price = (int)$currentPrice + 10; | |
} | |
update_post_meta( $post_id, '_regular_price', $regular_price ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment