Plugin Directory

Changeset 2728074


Ignore:
Timestamp:
05/22/2022 05:06:34 PM (4 years ago)
Author:
Hakik
Message:

Format Sale Price shows if not on sale

Location:
variation-price-display/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • variation-price-display/trunk/includes/conditions.php

    r2719756 r2728074  
    110110    function vpd_format_price( $format, $type, $product  ){
    111111
    112         if( 'yes' === $format ){
    113             $formatted_price =  wc_format_sale_price( wc_price( $product->get_variation_regular_price( $type ) ), wc_price( $product->get_variation_sale_price( $type ) ) );
     112        switch ( $format ) {
     113
     114          case "yes":
     115
     116            if( $product->get_variation_regular_price( $type ) !== $product->get_variation_sale_price( $type ) ){
     117
     118                $formatted_price =  wc_format_sale_price( wc_price( $product->get_variation_regular_price( $type ) ), wc_price( $product->get_variation_sale_price( $type ) ) );
     119            }
     120            else{
     121
     122                $formatted_price = wc_price( $product->get_variation_price( $type ) );
     123
     124            }
     125
    114126            $price = apply_filters( 'vpd_formatted_price', $formatted_price, $type, $product );
    115         }
    116         else{
    117             $formatted_price = wc_price( $product->get_variation_price( $type ) );
     127
     128            break;
     129
     130          default:
     131
     132            $formatted_price = wc_price( $product->get_variation_price( $type ) );
     133
    118134            $price = apply_filters( 'vpd_non_formatted_price', $formatted_price, $type, $product );
     135
    119136        }
    120137
  • variation-price-display/trunk/readme.txt

    r2719756 r2728074  
    1 === Variation Price Range Display for WooCommerce ===
     1=== Variation Price Display Range for WooCommerce ===
    22Contributors: hakik
    33Tags: price range, variation price, price display
     
    1515== Description ==
    1616
    17 **Variation Price Range Display for WooCommerce** plugin lets you change the price displayed on both the shop page and the single product page.
     17**Variation Price Display Range for WooCommerce** plugin lets you change the price displayed on both the shop page and the single product page.
    1818
    1919By default, variable products on WooCommerce display a range of prices from lowest to highest.
     
    7474== Frequently Asked Questions ==
    7575
    76 = What is the purpose of the Variation Price Range Display for WooCommerce? =
     76= What is the purpose of the Variation Price Display Range for WooCommerce? =
    7777 
    78 Variation Price Range Display for WooCommerce replaces the default Variation price range in both shop and single product page. You can show Minimum Price, Maximum Price, Minimum to Maximum Price, Maximum to Minimum Price.
     78Variation Price Display Range for WooCommerce replaces the default Variation price range in both shop and single product page. You can show Minimum Price, Maximum Price, Minimum to Maximum Price, Maximum to Minimum Price.
    7979
    8080= Can change the price according to selected variation? =
     
    8888
    8989== Changelog ==
     90
     91= 1.1.5 [22-05-2022] =
     92* Fix: Format Sale Price shows if not on sale.
     93* Compatibility: Tested with WooCommerce 6.5.1.
    9094
    9195= 1.1.4 [07-05-2022] =
  • variation-price-display/trunk/variation-price-display.php

    r2719756 r2728074  
    11<?php
    22/**
    3  * Plugin Name: Variation Price Range Display for WooCommerce
     3 * Plugin Name: Variation Price Display Range for WooCommerce
    44 * Plugin URI: https://wordpress.org/plugins/variation-price-display
    55 * Description: Adds lots of advanced options to control how you display the price for your WooCommerce variable products.
    66 * Author: Hakik Zaman
    7  * Version: 1.1.4
     7 * Version: 1.1.5
    88 * Domain Path: /languages
    99 * Requires at least: 5.5
     
    1111 * Requires PHP: 7.0
    1212 * WC requires at least: 5.5
    13  * WC tested up to: 6.4.0
     13 * WC tested up to: 6.5.1
    1414 * Text Domain: variation-price-display
    1515 * Author URI: https://github.com/hakikz
     
    3434         */
    3535
    36         protected $_version = '1.1.4';
     36        protected $_version = '1.1.5';
    3737
    3838        /*
Note: See TracChangeset for help on using the changeset viewer.