تابع wc_products_array_orderby_price نمایش محصولات از ارزان به گران قیمت

تابع wc_products_array_orderby_price نمایش محصولات از ارزان به گران قیمت

تابع ووکامرسی wc_products_array_orderby_price – نمایش محصولات از ارزان به گران قیمت

Syntax – سینتکس

(int) wc_products_array_orderby_price( (WC_Product) $a, (WC_Product) $b ); 

Parameters – پارامتر ها (2)

  • 1- $a (WC_Product)
  • 2- $b (WC_Product)

Usage – نحوه استفاده

if ( !function_exists( 'wc_products_array_orderby_price' ) ) { 
    require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-product-functions.php'; 
} 
  
// object $a 
$a = null; 
  
// object $b 
$b = null; 
  
// NOTICE! Understand what this does before running. 
$result = wc_products_array_orderby_price($a, $b); 
    

Defined – محل تعریف

/includes/wc-product-functions.php

function wc_products_array_orderby_price( $a, $b ) { 
    if ( $a->get_price() === $b->get_price() ) { 
        return 0; 
    } 
    return ( $a->get_price() < $b->get_price() ) ? -1 : 1; 
} 

versions – نسخه ها

از نسخه : 3.0.0

نسخه فعلی : 3.0.6

دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2

ارسال نظر

جهت استفاده از کد حتما از تگ pre استفاده نمایید .

contact us