• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_woocommerce_currency函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_woocommerce_currency函数的典型用法代码示例。如果您正苦于以下问题:PHP get_woocommerce_currency函数的具体用法?PHP get_woocommerce_currency怎么用?PHP get_woocommerce_currency使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_woocommerce_currency函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct()
 {
     global $woocommerce;
     $this->id = 'hygglig_checkout';
     $this->method_title = __('Hygglig', 'woocommerce');
     $this->method_description = __('Betala med Hygglig', 'woocommerce');
     $this->shop_country = get_option('woocommerce_default_country');
     // Check if woocommerce_default_country includes state as well. If it does, remove state
     if (strstr($this->shop_country, ':')) {
         $this->shop_country = current(explode(':', $this->shop_country));
     } else {
         $this->shop_country = $this->shop_country;
     }
     // Get current customers selected language if this is a multi lanuage site
     $iso_code = explode('_', get_locale());
     $this->shop_language = strtoupper($iso_code[0]);
     // Country ISO code (SE)
     //Switch built to allow for addition of more countries
     switch ($this->shop_language) {
         case 'SV':
             $this->shop_language = 'SE';
             break;
     }
     // Currency
     $this->selected_currency = get_woocommerce_currency();
     // Apply filters to shop_country
     $this->shop_country = apply_filters('hygglig_shop_country', $this->shop_country);
 }
开发者ID:Hygglig,项目名称:New_Hygglig_WooCommerce,代码行数:28,代码来源:gateway-hygglig.php


示例2: calculate_shipping

 public function calculate_shipping($package = array())
 {
     $request = array('recipient' => array('address1' => $package['destination']['address'], 'address2' => $package['destination']['address_2'], 'city' => $package['destination']['city'], 'state_code' => $package['destination']['state'], 'country_code' => $package['destination']['country'], 'zip' => $package['destination']['postcode']), 'items' => array(), 'currency' => get_woocommerce_currency());
     foreach ($package['contents'] as $item) {
         if (!empty($item['data']) && ($item['data']->is_virtual() || $item['data']->is_downloadable())) {
             continue;
         }
         $request['items'][] = array('external_variant_id' => $item['variation_id'] ? $item['variation_id'] : $item['product_id'], 'quantity' => $item['quantity']);
     }
     if (!$request['items']) {
         return false;
     }
     try {
         $client = Printful_Integration::instance()->get_client();
     } catch (PrintfulException $e) {
         $this->set_error($e);
         return false;
     }
     try {
         $response = $client->post('shipping/rates', $request, array('expedited' => true));
         foreach ($response as $rate) {
             $rateData = array('id' => $this->id . '_' . $rate['id'], 'label' => $rate['name'], 'cost' => $rate['rate'], 'taxes' => false, 'calc_tax' => 'per_order');
             $this->add_rate($rateData);
         }
     } catch (PrintfulException $e) {
         $this->set_error($e);
         return false;
     }
 }
开发者ID:mjtarter,项目名称:y8,代码行数:29,代码来源:class-printful-shipping.php


示例3: process_subscription_payment

 /**
  * Process the subscription payment and return the result
  *
  * @access      public
  * @param       int $amount
  * @return      array
  */
 public function process_subscription_payment($amount = 0)
 {
     global $s4wc;
     // Can't send to stripe without a value, assume it's good to go.
     if ($amount === 0) {
         return true;
     }
     // Get customer id
     $customer = get_user_meta($this->order->user_id, $s4wc->settings['stripe_db_location'], true);
     // Allow options to be set without modifying sensitive data like amount, currency, etc.
     $stripe_charge_data = apply_filters('s4wc_subscription_charge_data', array(), $this->order);
     // Set up basics for charging
     $stripe_charge_data['amount'] = $amount * 100;
     // amount in cents
     $stripe_charge_data['currency'] = strtolower(get_woocommerce_currency());
     $stripe_charge_data['customer'] = $customer['customer_id'];
     $stripe_charge_data['card'] = $customer['default_card'];
     $stripe_charge_data['description'] = $this->get_charge_description('subscription');
     $stripe_charge_data['expand[]'] = 'balance_transaction';
     $charge = S4WC_API::create_charge($stripe_charge_data);
     if (isset($charge->id)) {
         $this->order->add_order_note(sprintf(__('Subscription paid (%s)', 'stripe-for-woocommerce'), $charge->id));
         return $charge;
     }
     return false;
 }
开发者ID:tccyp001,项目名称:onemore-wordpress,代码行数:33,代码来源:class-s4wc_subscriptions_gateway.php


示例4: get_currency_countries

 /**
  * get_currency_countries.
  *
  * @version 2.3.9
  */
 function get_currency_countries($limit_currencies = '')
 {
     $country_currency = wcj_get_country_currency();
     if ('' != $limit_currencies) {
         $default_currency = get_woocommerce_currency();
         if ('paypal_only' === $limit_currencies || 'paypal_and_yahoo_exchange_rates_only' === $limit_currencies) {
             $paypal_supported_currencies = wcj_get_paypal_supported_currencies();
         }
         if ('yahoo_exchange_rates_only' === $limit_currencies || 'paypal_and_yahoo_exchange_rates_only' === $limit_currencies) {
             $yahoo_exchange_rates_supported_currencies = wcj_get_yahoo_exchange_rates_supported_currency();
         }
     }
     $currencies = array();
     foreach ($country_currency as $country => $currency) {
         if ('paypal_only' === $limit_currencies) {
             if (!isset($paypal_supported_currencies[$currency])) {
                 $currency = $default_currency;
             }
         } elseif ('yahoo_exchange_rates_only' === $limit_currencies) {
             if (!isset($yahoo_exchange_rates_supported_currencies[$currency])) {
                 $currency = $default_currency;
             }
         } elseif ('paypal_and_yahoo_exchange_rates_only' === $limit_currencies) {
             if (!isset($paypal_supported_currencies[$currency]) || !isset($yahoo_exchange_rates_supported_currencies[$currency])) {
                 $currency = $default_currency;
             }
         }
         $currencies[$currency][] = $country;
     }
     return $currencies;
 }
开发者ID:algoritmika,项目名称:woocommerce-jetpack,代码行数:36,代码来源:class-wcj-price-by-country-group-generator.php


示例5: accounting

 /**
  * Get the accounting format from user settings
  * POS uses a plugin to format currency: http://josscrowcroft.github.io/accounting.js/
  *
  * @return array $settings
  */
 private function accounting()
 {
     $decimal = get_option('woocommerce_price_decimal_sep');
     $thousand = get_option('woocommerce_price_thousand_sep');
     $precision = get_option('woocommerce_price_num_decimals');
     return array('currency' => array('decimal' => $decimal, 'format' => $this->currency_format(), 'precision' => $precision, 'symbol' => get_woocommerce_currency_symbol(get_woocommerce_currency()), 'thousand' => $thousand), 'number' => array('decimal' => $decimal, 'precision' => $precision, 'thousand' => $thousand));
 }
开发者ID:rpidanny,项目名称:WooCommerce-POS,代码行数:13,代码来源:class-wc-pos-params.php


示例6: pay

 /**
  * Pay method, used to process payment requests
  *
  * @param $payment_detail  array  Array of parameters for the single requests
  * Excepts at least the following parameters for each payment to process
  * [
  *     paypal_email => string (Paypal email of the receiver)
  *     amount => float (Amount to pay to user)
  *     request_id => int (Unique id of the request paid)
  * ]
  *
  * @return array An array holding the status of the operation; it should have at least a boolean status, a verbose status and an array of messages
  * [
  *     status => bool (status of the operation)
  *     verbose_status => string (one between PAYMENT_STATUS_OK and PAYMENT_STATUS_FAIL)
  *     messages => string|array (one or more message describing operation status)
  * ]
  * @since 1.0
  * @author Antonio La Rocca <[email protected]>
  */
 public function pay($payment_detail)
 {
     // include required libraries
     require_once dirname(dirname(__FILE__)) . '/third-party/PayPal/PayPal.php';
     // retrieve saved options from panel
     $stored_options = $this->get_gateway_options();
     $currency = get_woocommerce_currency();
     if (empty($stored_options['api_username']) || empty($stored_options['api_password']) || empty($stored_options['api_signature'])) {
         return array('status' => false, 'verbose_status' => YITH_Vendors_Gateway::PAYMENT_STATUS_FAIL, 'messages' => __('Missing required parameters for PayPal configuration', 'yith_wc_product_vendors'));
     }
     $PayPalConfig = array('Sandbox' => !($stored_options['sandbox'] == 'no'), 'APIUsername' => $stored_options['api_username'], 'APIPassword' => $stored_options['api_password'], 'APISignature' => $stored_options['api_signature'], 'PrintHeaders' => true, 'LogResults' => false);
     $PayPal = new PayPal($PayPalConfig);
     // Prepare request arrays
     $MPFields = array('emailsubject' => $stored_options['payment_mail_subject'], 'currencycode' => $currency, 'receivertype' => 'EmailAddress');
     $MPItems = array();
     foreach ($payment_detail as $payment) {
         $MPItems[] = array('l_email' => $payment['paypal_email'], 'l_amt' => $payment['amount'], 'l_uniqueid' => $payment['request_id']);
     }
     $PayPalRequestData = array('MPFields' => $MPFields, 'MPItems' => $MPItems);
     $PayPalResult = $PayPal->MassPay($PayPalRequestData);
     $errors = array();
     if ($PayPalResult['ACK'] == self::PAYMENT_STATUS_FAIL) {
         foreach ($PayPalResult['ERRORS'] as $error) {
             $errors[] = $error['L_LONGMESSAGE'];
         }
     }
     return array('status' => $PayPalResult['ACK'] == self::PAYMENT_STATUS_OK, 'verbose_status' => $PayPalResult['ACK'], 'messages' => $PayPalResult['ACK'] == self::PAYMENT_STATUS_FAIL ? implode("\n", $errors) : __('Payment sent', 'yith_wc_product_vendors'));
 }
开发者ID:shwetadubey,项目名称:upfit,代码行数:48,代码来源:class-yith-gateway-paypal.php


示例7: is_valid_for_use

 public function is_valid_for_use()
 {
     if (!in_array(get_woocommerce_currency(), apply_filters('wc_korea_pack_supported_currencies_bank', $this->supported_currencies))) {
         return false;
     }
     return true;
 }
开发者ID:parkmap,项目名称:woocommerce-paygate-jt,代码行数:7,代码来源:class-wc-gateway-paygate-bank.php


示例8: admin_options

    public function admin_options()
    {
        // Check curentcy.
        if (get_woocommerce_currency() != "DKK") {
            echo '<div class="error">
				<p>' . sprintf(__('Send24 requires that the <a href="%s">currency</a> is set to Danish Krone (DKK).', 'woocommerce-shipping-usps'), admin_url('admin.php?page=wc-settings&tab=general')) . '</p>
			</div>';
        }
        // Save/Update key.
        if (empty($this->send24_settings)) {
            add_option('send24_settings', $this->settings);
        } else {
            update_option('send24_settings', $this->settings);
        }
        // Check keys and zip user.
        if ($_POST) {
            $this->check_key_and_zip($_POST['woocommerce_send24_shipping_c_key'], $_POST['woocommerce_send24_shipping_c_secret'], $_POST['woocommerce_send24_shipping_zip']);
        } else {
            $this->check_key_and_zip($this->send24_settings['c_key'], $this->send24_settings['c_secret'], $this->send24_settings['zip']);
        }
        // Show settings
        parent::admin_options();
        // Check and show service.
        if ($_POST) {
            if (!empty($_POST['woocommerce_send24_shipping_enabled_services'])) {
                echo $this->generate_services_html($_POST['woocommerce_send24_shipping_enabled_services']);
            } else {
                echo $this->generate_services_html('no');
            }
        } else {
            echo $this->generate_services_html($this->send24_settings['enabled_services']);
        }
    }
开发者ID:Send24com,项目名称:Send24-for-WooCommerce,代码行数:33,代码来源:class.shipping_method.php


示例9: cs_product_parceled_single

/**
 * Displays the Installments on the product page.
 *
 * @return string Price in 3 installments.
 */
function cs_product_parceled_single()
{
    $product = get_product();
    ?>
    <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">

        <p style="margin: 0;" itemprop="price" class="price">
            <?php 
    echo $product->get_price_html();
    ?>
        </p>
        <p>
            <span style="color: #666; font-size: 100%" class="price"><?php 
    _e('ou at&eacute; 3x de');
    ?>
 <?php 
    echo cs_product_parceled();
    ?>
</span>
        </p>

        <meta itemprop="priceCurrency" content="<?php 
    echo get_woocommerce_currency();
    ?>
" />
        <link itemprop="availability" href="http://schema.org/<?php 
    echo $product->is_in_stock() ? 'InStock' : 'OutOfStock';
    ?>
" />
    </div>
<?php 
}
开发者ID:zerocowl,项目名称:desventuras,代码行数:37,代码来源:plg_parcela.php


示例10: is_valid_for_use

 /**
  * Check if this gateway is enabled and available in the user's country.
  *
  * @return bool
  */
 public function is_valid_for_use()
 {
     if (!in_array(get_woocommerce_currency(), array('BRL'))) {
         return false;
     }
     return true;
 }
开发者ID:renannprado,项目名称:woocommerce-komerci,代码行数:12,代码来源:class-wc-komerci-gateway.php


示例11: makePayload

 public function makePayload(\FS\Components\Order\ShoppingOrder $order)
 {
     $payload = array();
     $settings = $this->getApplicationContext()->getComponent('\\FS\\Components\\Settings');
     $shipment = $order->getFlagShipRaw();
     $service = $order->getShippingService();
     // shipment created
     if ($shipment) {
         $payload['type'] = 'created';
         $payload['shipment'] = $shipment;
         return $payload;
     }
     // quoted but no shipment created
     if (!$shipment && $service['provider'] == $settings['FLAGSHIP_SHIPPING_PLUGIN_ID']) {
         $payload['type'] = 'create';
         $payload['service'] = $service;
         $payload['cod'] = array('currency' => strtoupper(get_woocommerce_currency()));
     }
     // possibly not quoted with FS
     if (!isset($payload['type'])) {
         $payload['type'] = 'unavailable';
     }
     // requotes
     if ($requoteRates = $order->getAttribute('flagship_shipping_requote_rates')) {
         $payload['requote_rates'] = $requoteRates;
     }
     return $payload;
 }
开发者ID:flagshipcompany,项目名称:flagship-for-woocommerce,代码行数:28,代码来源:MetaBoxViewerFactory.php


示例12: generate_razorpay_form

        /**
         * Generate razorpay button link
         **/
        public function generate_razorpay_form($order_id)
        {
            global $woocommerce;
            $order = new WC_Order($order_id);
            $redirect_url = get_site_url() . '/?wc-api' . "=" . get_class($this);
            $productinfo = "Order {$order_id}";
            $razorpay_args = array('key' => $this->key_id, 'name' => get_bloginfo('name'), 'amount' => $order->order_total * 100, 'currency' => get_woocommerce_currency(), 'description' => $productinfo, 'prefill' => array('name' => $order->billing_first_name . " " . $order->billing_last_name, 'email' => $order->billing_email, 'contact' => $order->billing_phone), 'notes' => array('woocommerce_order_id' => $order_id));
            $json = json_encode($razorpay_args);
            $html = <<<EOT
<script src="{$this->liveurl}"></script>
<script>
    var data = {$json};
</script>
<form name='razorpayform' action="{$redirect_url}" method="POST">
    <input type="hidden" name="merchant_order_id" value="{$order_id}">
    <input type="hidden" name="razorpay_payment_id" id="razorpay_payment_id">
</form>
<script>
    data.backdropClose = false;
    data.handler = function(payment){
      document.getElementById('razorpay_payment_id').value = 
        payment.razorpay_payment_id;
      document.razorpayform.submit();
    };
    var razorpayCheckout = new Razorpay(data);
    razorpayCheckout.open();
</script>
<p>
<button id="btn-razorpay" onclick="razorpayCheckout.open();">Pay Now</button>
<button onclick="document.razorpayform.submit()">Cancel</button>
</p>

EOT;
            return $html;
        }
开发者ID:kdclabs,项目名称:razorpay-woocommerce,代码行数:38,代码来源:razorpay-payments.php


示例13: init_form_fields

 function init_form_fields()
 {
     $this->form_fields = array('enabled' => array('title' => __('Activar/Desactivar', 'meowallet'), 'label' => __('Activar o MEO Wallet', 'meowallet'), 'type' => 'checkbox', 'description' => __('Activar o MEO Wallet', 'meowallet'), 'default' => 'yes'), 'title' => array('title' => __('Titulo', 'meowallet'), 'type' => 'text', 'description' => __('Dá um titulo à forma de pagamento para ser visto durante o pagamento', 'meowallet'), 'default' => __('MEO Wallet', 'meowallet')), 'description' => array('title' => __('Descrição', 'meowallet'), 'type' => 'textarea', 'description' => __('Oferece uma Descrição da forma de pagamento por MEO Wallet aos seus clientes para ser vista durante o processo de pagamento', 'meowallet'), 'default' => __('Pagar com MEO Wallet - MEO Wallet, Multibanco, Cartão de Crédito/Débito', 'meowallet')), 'apikey_live' => array('title' => __('Chave API', 'meowallet'), 'type' => 'text', 'description' => __('Introduza a sua Chave API do MEO Wallet . Não é a mesma que a Chave API do MEO Wallet-Sandbox. <br />Para obter a sua Chave API, clique <a target="_blank" href="https://www.sandbox.meowallet.pt/login/">aqui</a>', 'meowallet'), 'default' => '', 'class' => 'production_settings sensitive'), 'apikey_sandbox' => array('title' => __('Chave API Sandbox', 'meowallet'), 'type' => 'text', 'description' => __('Introduza a sua Chave API de testes do MEO Wallet. <br />Para obter a sua Chave API, clique <a target="_blank" href="https://www.wallet.pt/login/">aqui</a>', 'meowallet'), 'default' => '', 'class' => 'sandbox_settings sensitive'), 'environment' => array('title' => __('Escolher Ambiente de Trabalho', 'meowallet'), 'type' => 'select', 'label' => __('Activar o MEO Wallet em modo de tests!', 'meowallet'), 'description' => __('Escolha o seu Ambiente de Trabalho entre Teste e Produção.', 'meowallet'), 'default' => 'sandbox', 'options' => array('sandbox' => __('Teste', 'meowallet'), 'production' => __('Produção', 'meowallet'))));
     if (get_woocommerce_currency() != 'EUR') {
         $this->form_fields['ex_to_euro'] = array('title' => __("Taxa de Cambio para Euro", 'meowallet'), 'type' => 'text', 'description' => 'Taxa de Cambio para Euro', 'default' => '1');
     }
 }
开发者ID:jquiterio,项目名称:meowallet,代码行数:7,代码来源:meowallet.php


示例14: maybe_show_admin_notices

 /**
  * Display an assortment of notices to administrators to encourage them to get PayPal setup right.
  *
  * @since 2.0
  */
 public static function maybe_show_admin_notices()
 {
     self::maybe_disable_invalid_profile_notice();
     self::maybe_update_credentials_error_flag();
     if (!in_array(get_woocommerce_currency(), apply_filters('woocommerce_paypal_supported_currencies', array('AUD', 'BRL', 'CAD', 'MXN', 'NZD', 'HKD', 'SGD', 'USD', 'EUR', 'JPY', 'TRY', 'NOK', 'CZK', 'DKK', 'HUF', 'ILS', 'MYR', 'PHP', 'PLN', 'SEK', 'CHF', 'TWD', 'THB', 'GBP', 'RMB')))) {
         $valid_for_use = false;
     } else {
         $valid_for_use = true;
     }
     $payment_gateway_tab_url = admin_url('admin.php?page=wc-settings&tab=checkout&section=wc_gateway_paypal');
     $notices = array();
     if ($valid_for_use && 'yes' == WCS_PayPal::get_option('enabled') && !has_action('admin_notices', 'WC_Subscriptions_Admin::admin_installed_notice') && current_user_can('manage_options')) {
         if (!WCS_PayPal::are_credentials_set()) {
             $notices[] = array('type' => 'warning', 'text' => sprintf(esc_html__('PayPal is inactive for subscription transactions. Please %1$sset up the PayPal IPN%2$s and %3$senter your API credentials%4$s to enable PayPal for Subscriptions.', 'woocommerce-subscriptions'), '<a href="http://docs.woothemes.com/document/subscriptions/store-manager-guide/#section-4" target="_blank">', '</a>', '<a href="' . esc_url($payment_gateway_tab_url) . '">', '</a>'));
         } elseif ('woocommerce_page_wc-settings' === get_current_screen()->base && isset($_GET['tab']) && in_array($_GET['tab'], array('subscriptions', 'checkout')) && !WCS_PayPal::are_reference_transactions_enabled()) {
             $notices[] = array('type' => 'warning', 'text' => sprintf(esc_html__('%1$sPayPal Reference Transactions are not enabled on your account%2$s, some subscription management features are not enabled. Please contact PayPal and request they %3$senable PayPal Reference Transactions%4$s on your account. %5$sCheck PayPal Account%6$s  %7$sLearn more %8$s', 'woocommerce-subscriptions'), '<strong>', '</strong>', '<a href="http://docs.woothemes.com/document/subscriptions/store-manager-guide/#section-4" target="_blank">', '</a>', '</p><p><a class="button" href="' . esc_url(wp_nonce_url(add_query_arg('wcs_paypal', 'check_reference_transaction_support'), __CLASS__)) . '">', '</a>', '<a class="button button-primary" href="http://docs.woothemes.com/document/subscriptions/store-manager-guide/#section-4" target="_blank">', '&raquo;</a>'));
         }
         if (isset($_GET['wcs_paypal']) && 'rt_enabled' === $_GET['wcs_paypal']) {
             $notices[] = array('type' => 'confirmation', 'text' => sprintf(esc_html__('%1$sPayPal Reference Transactions are enabled on your account%2$s. All subscription management features are now enabled. Happy selling!', 'woocommerce-subscriptions'), '<strong>', '</strong>'));
         }
         if (false !== get_option('wcs_paypal_credentials_error')) {
             $notices[] = array('type' => 'error', 'text' => sprintf(esc_html__('There is a problem with PayPal. Your API credentials may be incorrect. Please update your %1$sAPI credentials%2$s. %3$sLearn more%4$s.', 'woocommerce-subscriptions'), '<a href="' . esc_url($payment_gateway_tab_url) . '">', '</a>', '<a href="https://support.woothemes.com/hc/en-us/articles/202882473#paypal-credentials" target="_blank">', '</a>'));
         }
         if ('yes' == get_option('wcs_paypal_invalid_profile_id')) {
             $notices[] = array('type' => 'error', 'text' => sprintf(esc_html__('There is a problem with PayPal. Your PayPal account is issuing out-of-date subscription IDs. %1$sLearn more%2$s. %3$sDismiss%4$s.', 'woocommerce-subscriptions'), '<a href="https://support.woothemes.com/hc/en-us/articles/202882473#old-paypal-account" target="_blank">', '</a>', '<a href="' . esc_url(add_query_arg('wcs_disable_paypal_invalid_profile_id_notice', 'true')) . '">', '</a>'));
         }
     }
     if (!empty($notices)) {
         include_once dirname(__FILE__) . '/../templates/admin-notices.php';
     }
 }
开发者ID:DustinHartzler,项目名称:TheCLEFT,代码行数:36,代码来源:class-wcs-paypal-admin.php


示例15: vc_gitem_template_attribute_woocommerce_product

/**
 * Gte woocommerce data for product
 *
 * @param $value
 * @param $data
 *
 * @return string
 */
function vc_gitem_template_attribute_woocommerce_product($value, $data)
{
    $label = '';
    /**
     * @var null|Wp_Post $post ;
     * @var string $data ;
     */
    extract(array_merge(array('post' => null, 'data' => ''), $data));
    require_once WC()->plugin_path() . '/includes/abstracts/abstract-wc-product.php';
    $product = new WC_Product($post);
    if (preg_match('/_labeled$/', $data)) {
        $data = preg_replace('/_labeled$/', '', $data);
        $label = apply_filters('vc_gitem_template_attribute_woocommerce_product_' . $data . '_label', Vc_Vendor_Woocommerce::getProductFieldLabel($data) . ': ');
    }
    $price_format = get_woocommerce_price_format();
    switch ($data) {
        case 'id':
            $value = (int) $product->is_type('variation') ? $product->get_variation_id() : $product->id;
            break;
        case 'sku':
            $value = $product->get_sku();
            break;
        case 'price':
            $value = sprintf($price_format, wc_format_decimal($product->get_price(), 2), get_woocommerce_currency());
            break;
        case 'regular_price':
            $value = sprintf($price_format, wc_format_decimal($product->get_regular_price(), 2), get_woocommerce_currency());
            break;
        case 'sale_price':
            $value = sprintf(get_woocommerce_price_format(), $product->get_sale_price() ? wc_format_decimal($product->get_sale_price(), 2) : '', get_woocommerce_currency());
            break;
        case 'price_html':
            $value = $product->get_price_html();
            break;
        case 'reviews_count':
            $value = count(get_comments(array('post_id' => $post->ID, 'approve' => 'approve')));
            break;
        case 'short_description':
            $value = apply_filters('woocommerce_short_description', $product->get_post_data()->post_excerpt);
            break;
        case 'dimensions':
            $units = get_option('woocommerce_dimension_unit');
            $value = $product->length . $units . 'x' . $product->width . $units . 'x' . $product->height . $units;
            break;
        case 'raiting_count':
            $value = $product->get_rating_count();
            break;
        case 'weight':
            $value = $product->get_weight() ? wc_format_decimal($product->get_weight(), 2) : '';
            break;
        case 'on_sale':
            $value = $product->is_on_sale() ? 'yes' : 'no';
            // @todo change
            break;
        default:
            $value = $product->{$data};
    }
    return strlen($value) > 0 ? $label . apply_filters('vc_gitem_template_attribute_woocommerce_product_' . $data . '_value', $value) : '';
}
开发者ID:chicosilva,项目名称:olharambiental,代码行数:67,代码来源:grid-item-attributes.php


示例16: is_valid_for_use

 public function is_valid_for_use()
 {
     if (!in_array(get_woocommerce_currency(), array('NGN'))) {
         $this->msg = 'Voguepay doesn\'t support your store currency, set it to Nigerian Naira &#8358; <a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=wc-settings&tab=general">here</a>';
         return false;
     }
     return true;
 }
开发者ID:seyisulu,项目名称:voguepay-woocommerce-payment-gateway,代码行数:8,代码来源:voguepay-woocommerce-payment-gateway.php


示例17: set_express_checkout

 /**
  * Sets up the express checkout transaction
  *
  * @link https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECGettingStarted/#id084RN060BPF
  * @link https://developer.paypal.com/webapps/developer/docs/classic/api/merchant/SetExpressCheckout_API_Operation_NVP/
  *
  * @param array $args {
  *     @type string 'currency'              (Optional) A 3-character currency code (default is store's currency).
  *     @type string 'billing_type'          (Optional) Type of billing agreement for reference transactions. You must have permission from PayPal to use this field. This field must be set to one of the following values: MerchantInitiatedBilling - PayPal creates a billing agreement for each transaction associated with buyer. You must specify version 54.0 or higher to use this option; MerchantInitiatedBillingSingleAgreement - PayPal creates a single billing agreement for all transactions associated with buyer. Use this value unless you need per-transaction billing agreements. You must specify version 58.0 or higher to use this option.
  *     @type string 'billing_description'   (Optional) Description of goods or services associated with the billing agreement. This field is required for each recurring payment billing agreement if using MerchantInitiatedBilling as the billing type, that means you can use a different agreement for each subscription/order. PayPal recommends that the description contain a brief summary of the billing agreement terms and conditions (but this only makes sense when the billing type is MerchantInitiatedBilling, otherwise the terms will be incorrectly displayed for all agreements). For example, buyer is billed at "9.99 per month for 2 years".
  *     @type string 'maximum_amount'        (Optional) The expected maximum total amount of the complete order and future payments, including shipping cost and tax charges. If you pass the expected average transaction amount (default 25.00). PayPal uses this value to validate the buyer's funding source.
  *     @type string 'no_shipping'           (Optional) Determines where or not PayPal displays shipping address fields on the PayPal pages. For digital goods, this field is required, and you must set it to 1. It is one of the following values: 0 – PayPal displays the shipping address on the PayPal pages; 1 – PayPal does not display shipping address fields whatsoever (default); 2 – If you do not pass the shipping address, PayPal obtains it from the buyer's account profile.
  *     @type string 'page_style'            (Optional) Name of the Custom Payment Page Style for payment pages associated with this button or link. It corresponds to the HTML variable page_style for customizing payment pages. It is the same name as the Page Style Name you chose to add or edit the page style in your PayPal Account profile.
  *     @type string 'brand_name'            (Optional) A label that overrides the business name in the PayPal account on the PayPal hosted checkout pages. Default: store name.
  *     @type string 'landing_page'          (Optional) Type of PayPal page to display. It is one of the following values: 'login' – PayPal account login (default); 'Billing' – Non-PayPal account.
  *     @type string 'payment_action'        (Optional) How you want to obtain payment. If the transaction does not include a one-time purchase, this field is ignored. Default 'Sale' – This is a final sale for which you are requesting payment (default). Alternative: 'Authorization' – This payment is a basic authorization subject to settlement with PayPal Authorization and Capture. You cannot set this field to Sale in SetExpressCheckout request and then change the value to Authorization or Order in the DoExpressCheckoutPayment request. If you set the field to Authorization or Order in SetExpressCheckout, you may set the field to Sale.
  *     @type string 'return_url'            (Required) URL to which the buyer's browser is returned after choosing to pay with PayPal.
  *     @type string 'cancel_url'            (Required) URL to which the buyer is returned if the buyer does not approve the use of PayPal to pay you.
  *     @type string 'custom'                (Optional) A free-form field for up to 256 single-byte alphanumeric characters
  * }
  * @since 2.0
  */
 public function set_express_checkout($args)
 {
     $default_description = sprintf(_x('Orders with %s', 'data sent to paypal', 'woocommerce-subscriptions'), get_bloginfo('name'));
     $defaults = array('currency' => get_woocommerce_currency(), 'billing_type' => apply_filters('woocommerce_subscriptions_paypal_billing_agreement_type', 'MerchantInitiatedBillingSingleAgreement', $args), 'billing_description' => html_entity_decode(apply_filters('woocommerce_subscriptions_paypal_billing_agreement_description', $default_description, $args), ENT_NOQUOTES, 'UTF-8'), 'maximum_amount' => null, 'no_shipping' => 1, 'page_style' => null, 'brand_name' => html_entity_decode(get_bloginfo('name'), ENT_NOQUOTES, 'UTF-8'), 'landing_page' => 'login', 'payment_action' => 'Sale', 'custom' => '');
     $args = wp_parse_args($args, $defaults);
     $this->set_method('SetExpressCheckout');
     $this->add_parameters(array('PAYMENTREQUEST_0_AMT' => 0, 'PAYMENTREQUEST_0_ITEMAMT' => 0, 'PAYMENTREQUEST_0_SHIPPINGAMT' => 0, 'PAYMENTREQUEST_0_TAXAMT' => 0, 'PAYMENTREQUEST_0_CURRENCYCODE' => $args['currency'], 'PAYMENTREQUEST_0_CUSTOM' => $args['custom'], 'L_BILLINGTYPE0' => $args['billing_type'], 'L_BILLINGAGREEMENTDESCRIPTION0' => wcs_get_paypal_item_name($args['billing_description']), 'L_BILLINGAGREEMENTCUSTOM0' => $args['custom'], 'RETURNURL' => $args['return_url'], 'CANCELURL' => $args['cancel_url'], 'PAGESTYLE' => $args['page_style'], 'BRANDNAME' => $args['brand_name'], 'LANDINGPAGE' => 'login' == $args['landing_page'] ? 'Login' : 'Billing', 'NOSHIPPING' => $args['no_shipping'], 'MAXAMT' => $args['maximum_amount'], 'PAYMENTREQUEST_0_PAYMENTACTION' => $args['payment_action']));
 }
开发者ID:ltdat287,项目名称:id.nhomdichvu,代码行数:30,代码来源:class-wcs-paypal-reference-transaction-api-request.php


示例18: check_currency

 function check_currency()
 {
     $current_currency = get_woocommerce_currency();
     if ($current_currency != 'IDR') {
         $exit_msg = 'Plugin MyOngkir Shipping must use IDR currency.';
         exit($exit_msg);
     }
 }
开发者ID:eezhal92,项目名称:myongkir,代码行数:8,代码来源:woocommerce-myongkir.php


示例19: wcml_convert_price

 function wcml_convert_price($formatted, $unformatted)
 {
     if (!is_admin()) {
         $currency = apply_filters('wcml_price_currency', get_woocommerce_currency());
         $formatted = strip_tags(wc_price(apply_filters('wcml_raw_price_amount', $unformatted), array('currency' => $currency)));
     }
     return $formatted;
 }
开发者ID:yjhcfzx,项目名称:test_woo,代码行数:8,代码来源:class-wcml-gravityforms.php


示例20: run

 function run()
 {
     global $woocommerce_wpml;
     if (isset($_POST['general_options']) && check_admin_referer('general_options', 'general_options_nonce') && wp_verify_nonce($_POST['wcml_nonce'], 'general_options')) {
         $woocommerce_wpml->settings['enable_multi_currency'] = $_POST['multi_currency'];
         $woocommerce_wpml->update_settings();
     }
     if (isset($_POST['currency_switcher_options']) && check_admin_referer('currency_switcher_options', 'currency_switcher_options_nonce') && wp_verify_nonce($_POST['wcml_nonce'], 'general_options')) {
         if (isset($_POST['currency_switcher_style'])) {
             $woocommerce_wpml->settings['currency_switcher_style'] = $_POST['currency_switcher_style'];
         }
         if (isset($_POST['wcml_curr_sel_orientation'])) {
             $woocommerce_wpml->settings['wcml_curr_sel_orientation'] = $_POST['wcml_curr_sel_orientation'];
         }
         if (isset($_POST['wcml_curr_template'])) {
             $woocommerce_wpml->settings['wcml_curr_template'] = $_POST['wcml_curr_template'];
         }
         $woocommerce_wpml->update_settings();
     }
     if (isset($_POST['wcml_update_languages_currencies']) && isset($_POST['currency_for']) && wp_verify_nonce($_POST['wcml_nonce'], 'wcml_update_languages_currencies')) {
         global $wpdb;
         $currencies = $_POST['currency_for'];
         foreach ($currencies as $key => $language_currency) {
             $exist_currency = $wpdb->get_var($wpdb->prepare("SELECT currency_id FROM " . $wpdb->prefix . "icl_languages_currencies WHERE language_code = %s", $key));
             if ($language_currency != get_woocommerce_currency()) {
                 if (!$exist_currency) {
                     $wpdb->insert($wpdb->prefix . 'icl_languages_currencies', array('currency_id' => $language_currency, 'language_code' => $key));
                 } else {
                     $wpdb->update($wpdb->prefix . 'icl_languages_currencies', array('currency_id' => $language_currency), array('language_code' => $key));
                     wp_safe_redirect(admin_url('admin.php?page=wpml-wcml'));
                 }
             } elseif ($exist_currency) {
                 $wpdb->query("DELETE FROM " . $wpdb->prefix . "icl_languages_currencies WHERE language_code = '{$key}'");
             }
         }
     }
     if (isset($_POST['wcml_file_path_options_table']) && wp_verify_nonce($_POST['wcml_nonce'], 'wcml_file_path_options_table')) {
         global $sitepress, $sitepress_settings;
         $woocommerce_wpml->settings['file_path_sync'] = $_POST['wcml_file_path_sync'];
         $woocommerce_wpml->update_settings();
         $new_value = $_POST['wcml_file_path_sync'] == 0 ? 2 : $_POST['wcml_file_path_sync'];
         $sitepress_settings['translation-management']['custom_fields_translation']['_downloadable_files'] = $new_value;
         $sitepress_settings['translation-management']['custom_fields_translation']['_file_paths'] = $new_value;
         $sitepress->save_settings($sitepress_settings);
     }
     if (isset($_POST['wcml_trsl_interface_table']) && wp_verify_nonce($_POST['wcml_nonce'], 'wcml_trsl_interface_table')) {
         $woocommerce_wpml->settings['trnsl_interface'] = $_POST['trnsl_interface'];
         $woocommerce_wpml->update_settings();
     }
     if (isset($_POST['wcml_products_sync_prop']) && wp_verify_nonce($_POST['wcml_nonce'], 'wcml_products_sync_prop')) {
         $woocommerce_wpml->settings[' 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_woocommerce_currency_symbol函数代码示例发布时间:2022-05-15
下一篇:
PHP get_woocommerce_currencies函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap