Plugin Directory

Changeset 3169811


Ignore:
Timestamp:
10/16/2024 06:52:38 AM (15 months ago)
Author:
pinal.shah
Message:

Update to version 2.6 from GitHub

Location:
quotes-for-woocommerce
Files:
28 edited
1 copied

Legend:

Unmodified
Added
Removed
  • quotes-for-woocommerce/tags/2.6/assets/css/qwc-frontend.css

    r3033995 r3169811  
    4242    display: none;
    4343}
    44    
    4544/* Only for large screens */
    4645@media (min-width: 700px) {
  • quotes-for-woocommerce/tags/2.6/changelog.txt

    r3153140 r3169811  
    11*** Quotes for WooCommerce ***
     2
     32024-10-16 - Version 2.6
     4* Tweak - Added some filters for compatibility with Premium 1.5.
     5* Fix - Address WooCommerce Payment Gateway API required fields.
    26
    372024-09-17 - Version 2.5
  • quotes-for-woocommerce/tags/2.6/class-quotes-wc.php

    r3153140 r3169811  
    2929         * @since 1.0.0
    3030         */
    31         public $version = '2.5';
     31        public $version = '2.6';
    3232
    3333        /**
     
    541541
    542542            $product_id = apply_filters( 'qwc_cart_check_item_product_id', $cart_item['product_id'], $cart_item );
    543 
    544             $quotes = product_quote_enabled( $product_id );
     543            $quantity   = isset( $cart_item['quantity'] ) ? $cart_item['quantity'] : 1;
     544
     545            $quotes = product_quote_enabled( $product_id, $quantity );
    545546
    546547            if ( $quotes && ! qwc_cart_display_price() ) {
     
    597598
    598599            // Check if the product being added is quotable.
    599             $product_quotable = product_quote_enabled( $product_id );
     600            $product_quotable = product_quote_enabled( $product_id, $qty );
    600601
    601602            // Check if the cart contains a product that is quotable.
     
    636637            if ( ! $needs_payment ) {
    637638                foreach ( $cart->cart_contents as $cart_item ) {
    638                     $requires_quotes = product_quote_enabled( $cart_item['product_id'] );
     639                    $quantity = isset( $cart_item['quantity'] ) ? $cart_item['quantity'] : 1;
     640
     641                    $requires_quotes = product_quote_enabled( $cart_item['product_id'], $quantity );
    639642
    640643                    if ( $requires_quotes ) {
     
    891894
    892895            if ( is_array( $products ) && count( $products ) > 0 ) {
    893                 foreach ( $products as $product_id => $value ) {
    894                     if ( product_quote_enabled( $product_id ) ) {
     896                foreach ( $products as $product_id => $quantity ) {
     897                    if ( product_quote_enabled( $product_id, $quantity ) ) {
    895898                        $message = str_replace( 'added to your cart', "added to your $cart_name", $message );
    896899                        $message = str_replace( 'View cart', "View $cart_name", $message );
     
    947950         */
    948951        public function qwc_change_proceed_checkout_btn_text() {
    949             if ( cart_contains_quotable() ) {
     952            $modify_text = apply_filters( 'qwc_modify_proceed_checkout_button_text', true );
     953            if ( cart_contains_quotable() && $modify_text ) {
    950954                remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 );
    951955                $proceed_checkout_label = '' === get_option( 'qwc_proceed_checkout_btn_label', '' ) ? __( 'Proceed to Checkout', 'quote-wc' ) : get_option( 'qwc_proceed_checkout_btn_label' );
     
    966970         */
    967971        public function cart_needs_shipping( $needs_shipping ) {
    968             if ( cart_contains_quotable() && 'on' === get_option( 'qwc_hide_address_fields' ) ) {
     972            // Override lite verison shipping removal for quote orders by using this filter.
     973            $shipping_choice = apply_filters(
     974                'qwc_override_shipping_quotes',
     975                array(
     976                    'override'       => false,
     977                    'needs_shipping' => $needs_shipping,
     978                )
     979            );
     980            // Override should be returned true, if u want to override the default behaviour.
     981            if ( isset( $shipping_choice['override'] ) && $shipping_choice['override'] ) {
     982                if ( isset( $shipping_choice['needs_shipping'] ) ) {
     983                    return $shipping_choice['needs_shipping'];
     984                } else {  // if user choice not found after overriding, return as is.
     985                    return $needs_shipping;
     986                }
     987            } elseif ( cart_contains_quotable() && 'on' === get_option( 'qwc_hide_address_fields' ) ) { // default, free verison removes shipping for quote orders.
    969988                return false;
    970989            } else {
     
    9951014                );
    9961015
    997                 foreach ( $qwc_hide_fields_list as $field_name ) {
    998                     unset( $fields[ $field_name ] );
     1016                if ( is_array( $qwc_hide_fields_list ) && count( $qwc_hide_fields_list ) > 0 ) {
     1017                    foreach ( $qwc_hide_fields_list as $field_name ) {
     1018                        unset( $fields[ $field_name ] );
     1019                    }
    9991020                }
    10001021            }
     
    10251046                );
    10261047
    1027                 foreach ( $qwc_hide_fields_list as $field_name ) {
    1028                     unset( $fields['billing'][ $field_name ] );
     1048                if ( is_array( $qwc_hide_fields_list ) && count( $qwc_hide_fields_list ) > 0 ) {
     1049                    foreach ( $qwc_hide_fields_list as $field_name ) {
     1050                        unset( $fields['billing'][ $field_name ] );
     1051                    }
    10291052                }
    10301053            }
  • quotes-for-woocommerce/tags/2.6/includes/blocks/class-quotes-wc-blocks-integration.php

    r2949503 r3169811  
    2121            add_action( 'woocommerce_store_api_checkout_update_order_from_request', array( &$this, 'qwc_wc_blocks_update_order_meta_data' ), 10, 2 );
    2222            // Order has been processed, initiate emails.
    23             add_action( 'woocommerce_store_api_checkout_order_processed', array( &$this, 'qwc_init_quote_emails' ), 10, 1 );
     23            add_action( 'woocommerce_store_api_checkout_order_processed', array( &$this, 'qwc_init_quote_emails' ), 90, 1 );
    2424        }
    2525
     
    5252
    5353            if ( $order ) {
     54                $order_id = $order->get_id();
     55                $order_id = apply_filters( 'qwc_init_quote_emails', $order_id );
     56                $order    = wc_get_order( $order_id ); // We refetch the order obj to ensure the correct obj is used if the order Id was modified by the filter.
    5457                $quote    = order_requires_quote( $order );
    55                 $order_id = $order->get_id();
    56 
    5758                if ( $quote && isset( $order_id ) && $order_id > 0 ) {
    5859                    WC_Emails::instance();
     
    6162                }
    6263            }
    63 
    6464        }
    6565    }
  • quotes-for-woocommerce/tags/2.6/includes/class-quotes-payment-gateway.php

    r3153140 r3169811  
    3737            $this->order_button_text = '' === get_option( 'qwc_place_order_text', '' ) ? __( 'Request Quote', 'quote-wc' ) : __( get_option( 'qwc_place_order_text' ), 'quote-wc' ); // phpcs:ignore
    3838
    39             $this->description  = '';
    40             $this->instructions = '';
     39            $this->description        = '';
     40            $this->method_description = '';
     41            $this->instructions       = '';
    4142            // Actions.
    4243            add_filter( 'woocommerce_thankyou_order_received_text', array( &$this, 'thankyou_page' ), 10, 2 );
     
    99100            return $message;
    100101        }
    101 
    102102    }
    103103}
  • quotes-for-woocommerce/tags/2.6/includes/qwc-functions.php

    r3058097 r3169811  
    1111 *
    1212 * @param int $product_id - Product ID.
     13 * @param int $qty - Product Qty.
    1314 * @return bool $quotes_enabled - Quote Status.
    1415 */
    15 function product_quote_enabled( $product_id ) {
     16function product_quote_enabled( $product_id, $qty = 1 ) {
    1617    $quote_enabled = false;
    1718
     
    2324        }
    2425    }
    25     $quote_enabled = apply_filters( 'qwc_product_quote_enabled', $quote_enabled, $product_id );
     26    $quote_enabled = apply_filters( 'qwc_product_quote_enabled', $quote_enabled, $product_id, $qty );
    2627    return $quote_enabled;
    2728}
     
    5859            }
    5960            $product_id    = apply_filters( 'qwc_cart_check_item_product_id', $item['product_id'], $item );
    60             $quote_enabled = product_quote_enabled( $product_id );
     61            $quantity      = isset( $item['quantity'] ) ? $item['quantity'] : 1;
     62            $quote_enabled = product_quote_enabled( $product_id, $quantity );
    6163
    6264            if ( $quote_enabled ) {
     
    6769    }
    6870    return $quotable;
    69 
    7071}
    7172
     
    8283    if ( $order ) {
    8384        foreach ( $order->get_items() as $item ) {
    84             $product_quote = product_quote_enabled( $item['product_id'] );
     85            $quantity      = isset( $item['quantity'] ) ? $item['quantity'] : 1;
     86            $product_quote = product_quote_enabled( $item['product_id'], $quantity );
    8587            if ( $product_quote ) {
    8688                $requires = true;
     
    156158
    157159    return $display;
    158 
    159160}
    160161
     
    204205    }
    205206}
     207
     208/**
     209 * Returns whether the cart contains products with quotes.
     210 *
     211 * @return bool Cart has quote products or no.
     212 * @since 2.6
     213 */
     214function cart_contains_purchasable() {
     215
     216    $purchasable = false;
     217
     218    if ( isset( WC()->cart ) ) {
     219        foreach ( WC()->cart->cart_contents as $item ) {
     220
     221            if ( 0 === $item['product_id'] ) {
     222                $item['product_id'] = qwc_get_product_id_by_variation_id( $item['variation_id'] );
     223            }
     224            $product_id    = apply_filters( 'qwc_cart_check_item_product_id', $item['product_id'], $item );
     225            $quantity      = isset( $item['quantity'] ) ? $item['quantity'] : 1;
     226            $quote_enabled = product_quote_enabled( $product_id, $quantity );
     227
     228            if ( ! $quote_enabled ) {
     229                $purchasable = true;
     230                break;
     231            }
     232        }
     233    }
     234    return $purchasable;
     235}
     236
     237/**
     238 * Returns whether order contains non-quote (purchase) products or no.
     239 *
     240 * @param object $order - WC_Order.
     241 * @return bool|false - Order contains quot products | false when no data found.
     242 */
     243function order_contains_purchase( $order ) {
     244
     245    $purchasable = false;
     246
     247    if ( $order ) {
     248        foreach ( $order->get_items() as $item ) {
     249            $quantity      = isset( $item['quantity'] ) ? $item['quantity'] : 1;
     250            $product_quote = product_quote_enabled( $item['product_id'], $quantity );
     251            if ( ! $product_quote ) {
     252                $purchasable = true;
     253                break;
     254            }
     255        }
     256    }
     257
     258    return $purchasable;
     259}
  • quotes-for-woocommerce/tags/2.6/languages/quote-wc.pot

    r3153140 r3169811  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Quotes for WooCommerce 2.4\n"
     5"Project-Id-Version: Quotes for WooCommerce 2.5\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/quotes-for-woocommerce\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2024-09-16T16:43:57+02:00\n"
     12"POT-Creation-Date: 2024-10-15T13:10:54+02:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.11.0\n"
     
    4848
    4949#: class-quotes-wc.php:505
    50 #: class-quotes-wc.php:951
     50#: class-quotes-wc.php:955
    5151#: includes/admin/class-quotes-wc-general-settings.php:77
    5252msgid "Proceed to Checkout"
     
    5454
    5555#. translators: Leave price blanks as its not be displayed.
    56 #: class-quotes-wc.php:581
     56#: class-quotes-wc.php:582
    5757msgid "<strong>Subtotal:</strong> <span class='amount'>%s</span>"
    5858msgstr ""
    5959
    60 #: class-quotes-wc.php:619
     60#: class-quotes-wc.php:620
    6161msgid "It is not possible to add products that require quotes to the Cart along with ones that do not. Hence, the existing products have been removed from the Cart."
    6262msgstr ""
    6363
    64 #: class-quotes-wc.php:768
     64#: class-quotes-wc.php:771
    6565msgid "Quote Complete"
    6666msgstr ""
    6767
    68 #: class-quotes-wc.php:772
     68#: class-quotes-wc.php:775
    6969#: includes/emails/class-qwc-send-quote.php:24
    7070msgid "Send Quote"
    7171msgstr ""
    7272
    73 #: class-quotes-wc.php:774
     73#: class-quotes-wc.php:777
    7474msgid "Resend Quote"
    7575msgstr ""
    7676
    77 #: class-quotes-wc.php:803
     77#: class-quotes-wc.php:806
    7878msgid "Quote Complete."
    7979msgstr ""
    8080
    81 #: class-quotes-wc.php:872
     81#: class-quotes-wc.php:875
    8282msgid "Quote email sent to "
    8383msgstr ""
    8484
    85 #: class-quotes-wc.php:890
    86 #: class-quotes-wc.php:916
     85#: class-quotes-wc.php:893
     86#: class-quotes-wc.php:919
    8787#: includes/admin/class-quotes-wc-general-settings.php:75
    8888msgid "Cart"
    8989msgstr ""
    9090
    91 #: class-quotes-wc.php:922
     91#: class-quotes-wc.php:925
    9292#: includes/admin/class-quotes-wc-general-settings.php:76
    9393msgid "Checkout"
    9494msgstr ""
    9595
    96 #: class-quotes-wc.php:1044
    97 #: includes/class-quotes-payment-gateway.php:49
     96#: class-quotes-wc.php:1067
     97#: includes/class-quotes-payment-gateway.php:50
    9898msgid "Settings"
    9999msgstr ""
    100100
    101 #: class-quotes-wc.php:1045
     101#: class-quotes-wc.php:1068
    102102msgid "Get Quotes Pro"
    103103msgstr ""
    104104
    105 #: class-quotes-wc.php:1060
     105#: class-quotes-wc.php:1083
    106106msgid "Quotes menu has moved!"
    107107msgstr ""
    108108
    109 #: class-quotes-wc.php:1061
     109#: class-quotes-wc.php:1084
    110110msgid "The Quotes settings can now be managed from WooCommerce > Settings > Quotes."
    111111msgstr ""
     
    203203msgstr ""
    204204
    205 #: includes/class-quotes-payment-gateway.php:53
     205#: includes/class-quotes-payment-gateway.php:54
    206206msgid "This is a fictitious payment method used for quotes."
    207207msgstr ""
    208208
    209 #: includes/class-quotes-payment-gateway.php:54
     209#: includes/class-quotes-payment-gateway.php:55
    210210msgid "This gateway requires no configuration."
    211211msgstr ""
    212212
    213 #: includes/class-quotes-payment-gateway.php:74
     213#: includes/class-quotes-payment-gateway.php:75
    214214msgid "This order is awaiting quote."
    215215msgstr ""
    216216
    217 #: includes/class-quotes-payment-gateway.php:96
     217#: includes/class-quotes-payment-gateway.php:97
    218218msgid "We have received your request for a quote. You will be notified via email soon."
    219219msgstr ""
     
    402402msgstr ""
    403403
    404 #. translators: Site Name.
    405404#. translators: Customer Name.
    406405#: templates/emails/plain/request-new-quote.php:12
     
    409408msgstr ""
    410409
    411 #. translators: Order payment link.
    412 #. translators: Admin Url for payment.
     410#. translators: Admin Url for order.
    413411#: templates/emails/plain/request-new-quote.php:68
    414412#: templates/emails/request-new-quote.php:79
     
    416414msgstr ""
    417415
    418 #. translators: User first name.
    419416#. translators: Billing First Name.
    420417#: templates/emails/plain/send-quote.php:14
     
    423420msgstr ""
    424421
    425 #. translators: Site name.
    426422#. translators: Site Name.
    427423#: templates/emails/plain/send-quote.php:17
     
    430426msgstr ""
    431427
    432 #. translators: Payment URL.
    433428#. translators: Payment Link Url.
    434429#: templates/emails/plain/send-quote.php:24
  • quotes-for-woocommerce/tags/2.6/quotes-woocommerce.php

    r3153140 r3169811  
    33 * Plugin Name: Quotes for WooCommerce
    44 * Description: This plugin allows you to convert your WooCommerce store into a quote only store. It will hide the prices for the products and not take any payment at Checkout. You can then setup prices for the items in the order and send a notification to the Customer.
    5  * Version: 2.5
     5 * Version: 2.6
    66 * Author: TechnoVama
    77 * Requires at least: 4.5
     
    3030    add_action(
    3131        'admin_notices',
    32         function() {
     32        function () {
    3333            // translators: plugin name with link.
    3434            $msg = sprintf( __( 'Please install and activate %s before activating Quotes for WooCommerce.', 'quote-wc' ), '<a href="https://wordpress.org/plugins/woocommerce/" target="_blank">WooCommerce</a>' );
     
    5151add_action(
    5252    'before_woocommerce_init',
    53     function() {
     53    function () {
    5454        if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
    5555            \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
  • quotes-for-woocommerce/tags/2.6/readme.txt

    r3153140 r3169811  
    55Requires at least: 4.5
    66Tested up to: 6.6.2
    7 Stable tag: 2.5
     7Stable tag: 2.6
    88Requires PHP: 7.2
    99License: GPLv2 or later
     
    3838<ul>
    3939<li>Enable quotes for only some products in the store.</li>
     40<li>Allow quote and purchasable products in a single cart.</li>
    4041<li>Enable quotes for select variations of a product</li>
     42<li>Automatically enable quotes based on item quantity for each product.</li>
    4143<li>Customize quote button display based on WordPress User Roles</li>
    4244<li>Seamlessly process both regular orders and quote requests for all products</li>
     
    8183
    8284== Changelog ==
     85
     86= 2.6 ( 16.10.2024 ) =
     87* Tweak - Added some filters for compatibility with Premium 1.5.
     88* Fix - Address WooCommerce Payment Gateway API required fields.
    8389
    8490= 2.5 ( 17.09.2024 ) =
  • quotes-for-woocommerce/tags/2.6/templates/emails/new-quote-request-sent-customer.php

    r3153140 r3169811  
    4444            <tr>
    4545                <td style="text-align:left; border: 1px solid #eee;">
    46                     <a href='<?php echo esc_url( get_permalink( $product_id ) ); ?>' target='_blank'><?php echo wp_kses_post( $items->get_name() );?></a>
     46                    <a href='<?php echo esc_url( get_permalink( $product_id ) ); ?>' target='_blank'><?php echo wp_kses_post( $items->get_name() ); ?></a>
    4747                    <?php
    4848                    // allow other plugins to add additional product information here.
  • quotes-for-woocommerce/tags/2.6/templates/emails/plain/request-new-quote.php

    r3153140 r3169811  
    99$margin_side = is_rtl() ? 'left' : 'right';
    1010
    11 // translators: Site Name.
     11// translators: Customer Name.
    1212$opening_paragraph = __( 'A request for quote has been made by %s and is awaiting your attention. The details of the order are as follows:', 'quote-wc' );
    1313echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n";
     
    6565    echo "\n----------------------------------------\n\n";
    6666    echo sprintf( esc_html__( 'This order is awaiting a quote.', 'quote-wc' ) );
    67     // translators: Order payment link.
     67    // translators: Admin Url for order.
    6868    echo wp_kses_post( make_clickable( sprintf( __( 'You can view and edit this order in the dashboard here: %s', 'quote-wc' ), $order_url ) ) );
    6969
  • quotes-for-woocommerce/tags/2.6/templates/emails/plain/send-quote.php

    r3110434 r3169811  
    1111if ( $order ) :
    1212    $billing_first_name = ( version_compare( WOOCOMMERCE_VERSION, '3.0.0' ) < 0 ) ? $order->billing_first_name : $order->get_billing_first_name();
    13     // translators: User first name.
     13    // translators: Billing First Name.
    1414    echo sprintf( esc_html__( 'Hello %s', 'quote-wc' ), esc_attr( $billing_first_name ) ) . "\n\n";
    1515endif;
    16 // translators: Site name.
     16// translators: Site Name.
    1717echo sprintf( esc_html__( 'You have received a quotation for your order on %s. The details of the same are shown below.', 'quote-wc' ), esc_attr( $order_details->blogname ) );
    1818
     
    2121    $order_status = $order->get_status();
    2222    if ( 'pending' === $order_status ) :
    23         // translators: Payment URL.
     23        // translators: Payment Link Url.
    2424        echo sprintf( esc_html__( 'To pay for this order please use the following link: %s', 'quote-wc' ), esc_url( $order->get_checkout_payment_url() ) );
    2525    endif;
  • quotes-for-woocommerce/tags/2.6/templates/emails/request-new-quote.php

    r3153140 r3169811  
    7676<p>
    7777    <?php
    78     // translators: Admin Url for payment.
     78    // translators: Admin Url for order.
    7979    echo wp_kses_post( make_clickable( sprintf( __( 'You can view and edit this order in the dashboard here: %s', 'quote-wc' ), esc_url( $order_url ) ) ) );
    8080    ?>
  • quotes-for-woocommerce/tags/2.6/templates/emails/send-quote.php

    r3110434 r3169811  
    5353    }
    5454    ?>
    55     <h2><?php echo esc_html__( 'Order', 'quote-wc' ) . ': ' . esc_html( $order->get_order_number() ); ?> (<?php printf( '<time datetime="%s">%s</time>', wp_kses_post( date_i18n( 'c', strtotime( $order_date ) ) ), wp_kses_post( date_i18n( wc_date_format(), strtotime( $order_date ) ) ) );?>)</h2>
     55    <h2><?php echo esc_html__( 'Order', 'quote-wc' ) . ': ' . esc_html( $order->get_order_number() ); ?> (<?php printf( '<time datetime="%s">%s</time>', wp_kses_post( date_i18n( 'c', strtotime( $order_date ) ) ), wp_kses_post( date_i18n( wc_date_format(), strtotime( $order_date ) ) ) ); ?>)</h2>
    5656    <table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
    5757        <thead>
  • quotes-for-woocommerce/trunk/assets/css/qwc-frontend.css

    r3033995 r3169811  
    4242    display: none;
    4343}
    44    
    4544/* Only for large screens */
    4645@media (min-width: 700px) {
  • quotes-for-woocommerce/trunk/changelog.txt

    r3153140 r3169811  
    11*** Quotes for WooCommerce ***
     2
     32024-10-16 - Version 2.6
     4* Tweak - Added some filters for compatibility with Premium 1.5.
     5* Fix - Address WooCommerce Payment Gateway API required fields.
    26
    372024-09-17 - Version 2.5
  • quotes-for-woocommerce/trunk/class-quotes-wc.php

    r3153140 r3169811  
    2929         * @since 1.0.0
    3030         */
    31         public $version = '2.5';
     31        public $version = '2.6';
    3232
    3333        /**
     
    541541
    542542            $product_id = apply_filters( 'qwc_cart_check_item_product_id', $cart_item['product_id'], $cart_item );
    543 
    544             $quotes = product_quote_enabled( $product_id );
     543            $quantity   = isset( $cart_item['quantity'] ) ? $cart_item['quantity'] : 1;
     544
     545            $quotes = product_quote_enabled( $product_id, $quantity );
    545546
    546547            if ( $quotes && ! qwc_cart_display_price() ) {
     
    597598
    598599            // Check if the product being added is quotable.
    599             $product_quotable = product_quote_enabled( $product_id );
     600            $product_quotable = product_quote_enabled( $product_id, $qty );
    600601
    601602            // Check if the cart contains a product that is quotable.
     
    636637            if ( ! $needs_payment ) {
    637638                foreach ( $cart->cart_contents as $cart_item ) {
    638                     $requires_quotes = product_quote_enabled( $cart_item['product_id'] );
     639                    $quantity = isset( $cart_item['quantity'] ) ? $cart_item['quantity'] : 1;
     640
     641                    $requires_quotes = product_quote_enabled( $cart_item['product_id'], $quantity );
    639642
    640643                    if ( $requires_quotes ) {
     
    891894
    892895            if ( is_array( $products ) && count( $products ) > 0 ) {
    893                 foreach ( $products as $product_id => $value ) {
    894                     if ( product_quote_enabled( $product_id ) ) {
     896                foreach ( $products as $product_id => $quantity ) {
     897                    if ( product_quote_enabled( $product_id, $quantity ) ) {
    895898                        $message = str_replace( 'added to your cart', "added to your $cart_name", $message );
    896899                        $message = str_replace( 'View cart', "View $cart_name", $message );
     
    947950         */
    948951        public function qwc_change_proceed_checkout_btn_text() {
    949             if ( cart_contains_quotable() ) {
     952            $modify_text = apply_filters( 'qwc_modify_proceed_checkout_button_text', true );
     953            if ( cart_contains_quotable() && $modify_text ) {
    950954                remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 );
    951955                $proceed_checkout_label = '' === get_option( 'qwc_proceed_checkout_btn_label', '' ) ? __( 'Proceed to Checkout', 'quote-wc' ) : get_option( 'qwc_proceed_checkout_btn_label' );
     
    966970         */
    967971        public function cart_needs_shipping( $needs_shipping ) {
    968             if ( cart_contains_quotable() && 'on' === get_option( 'qwc_hide_address_fields' ) ) {
     972            // Override lite verison shipping removal for quote orders by using this filter.
     973            $shipping_choice = apply_filters(
     974                'qwc_override_shipping_quotes',
     975                array(
     976                    'override'       => false,
     977                    'needs_shipping' => $needs_shipping,
     978                )
     979            );
     980            // Override should be returned true, if u want to override the default behaviour.
     981            if ( isset( $shipping_choice['override'] ) && $shipping_choice['override'] ) {
     982                if ( isset( $shipping_choice['needs_shipping'] ) ) {
     983                    return $shipping_choice['needs_shipping'];
     984                } else {  // if user choice not found after overriding, return as is.
     985                    return $needs_shipping;
     986                }
     987            } elseif ( cart_contains_quotable() && 'on' === get_option( 'qwc_hide_address_fields' ) ) { // default, free verison removes shipping for quote orders.
    969988                return false;
    970989            } else {
     
    9951014                );
    9961015
    997                 foreach ( $qwc_hide_fields_list as $field_name ) {
    998                     unset( $fields[ $field_name ] );
     1016                if ( is_array( $qwc_hide_fields_list ) && count( $qwc_hide_fields_list ) > 0 ) {
     1017                    foreach ( $qwc_hide_fields_list as $field_name ) {
     1018                        unset( $fields[ $field_name ] );
     1019                    }
    9991020                }
    10001021            }
     
    10251046                );
    10261047
    1027                 foreach ( $qwc_hide_fields_list as $field_name ) {
    1028                     unset( $fields['billing'][ $field_name ] );
     1048                if ( is_array( $qwc_hide_fields_list ) && count( $qwc_hide_fields_list ) > 0 ) {
     1049                    foreach ( $qwc_hide_fields_list as $field_name ) {
     1050                        unset( $fields['billing'][ $field_name ] );
     1051                    }
    10291052                }
    10301053            }
  • quotes-for-woocommerce/trunk/includes/blocks/class-quotes-wc-blocks-integration.php

    r2949503 r3169811  
    2121            add_action( 'woocommerce_store_api_checkout_update_order_from_request', array( &$this, 'qwc_wc_blocks_update_order_meta_data' ), 10, 2 );
    2222            // Order has been processed, initiate emails.
    23             add_action( 'woocommerce_store_api_checkout_order_processed', array( &$this, 'qwc_init_quote_emails' ), 10, 1 );
     23            add_action( 'woocommerce_store_api_checkout_order_processed', array( &$this, 'qwc_init_quote_emails' ), 90, 1 );
    2424        }
    2525
     
    5252
    5353            if ( $order ) {
     54                $order_id = $order->get_id();
     55                $order_id = apply_filters( 'qwc_init_quote_emails', $order_id );
     56                $order    = wc_get_order( $order_id ); // We refetch the order obj to ensure the correct obj is used if the order Id was modified by the filter.
    5457                $quote    = order_requires_quote( $order );
    55                 $order_id = $order->get_id();
    56 
    5758                if ( $quote && isset( $order_id ) && $order_id > 0 ) {
    5859                    WC_Emails::instance();
     
    6162                }
    6263            }
    63 
    6464        }
    6565    }
  • quotes-for-woocommerce/trunk/includes/class-quotes-payment-gateway.php

    r3153140 r3169811  
    3737            $this->order_button_text = '' === get_option( 'qwc_place_order_text', '' ) ? __( 'Request Quote', 'quote-wc' ) : __( get_option( 'qwc_place_order_text' ), 'quote-wc' ); // phpcs:ignore
    3838
    39             $this->description  = '';
    40             $this->instructions = '';
     39            $this->description        = '';
     40            $this->method_description = '';
     41            $this->instructions       = '';
    4142            // Actions.
    4243            add_filter( 'woocommerce_thankyou_order_received_text', array( &$this, 'thankyou_page' ), 10, 2 );
     
    99100            return $message;
    100101        }
    101 
    102102    }
    103103}
  • quotes-for-woocommerce/trunk/includes/qwc-functions.php

    r3058097 r3169811  
    1111 *
    1212 * @param int $product_id - Product ID.
     13 * @param int $qty - Product Qty.
    1314 * @return bool $quotes_enabled - Quote Status.
    1415 */
    15 function product_quote_enabled( $product_id ) {
     16function product_quote_enabled( $product_id, $qty = 1 ) {
    1617    $quote_enabled = false;
    1718
     
    2324        }
    2425    }
    25     $quote_enabled = apply_filters( 'qwc_product_quote_enabled', $quote_enabled, $product_id );
     26    $quote_enabled = apply_filters( 'qwc_product_quote_enabled', $quote_enabled, $product_id, $qty );
    2627    return $quote_enabled;
    2728}
     
    5859            }
    5960            $product_id    = apply_filters( 'qwc_cart_check_item_product_id', $item['product_id'], $item );
    60             $quote_enabled = product_quote_enabled( $product_id );
     61            $quantity      = isset( $item['quantity'] ) ? $item['quantity'] : 1;
     62            $quote_enabled = product_quote_enabled( $product_id, $quantity );
    6163
    6264            if ( $quote_enabled ) {
     
    6769    }
    6870    return $quotable;
    69 
    7071}
    7172
     
    8283    if ( $order ) {
    8384        foreach ( $order->get_items() as $item ) {
    84             $product_quote = product_quote_enabled( $item['product_id'] );
     85            $quantity      = isset( $item['quantity'] ) ? $item['quantity'] : 1;
     86            $product_quote = product_quote_enabled( $item['product_id'], $quantity );
    8587            if ( $product_quote ) {
    8688                $requires = true;
     
    156158
    157159    return $display;
    158 
    159160}
    160161
     
    204205    }
    205206}
     207
     208/**
     209 * Returns whether the cart contains products with quotes.
     210 *
     211 * @return bool Cart has quote products or no.
     212 * @since 2.6
     213 */
     214function cart_contains_purchasable() {
     215
     216    $purchasable = false;
     217
     218    if ( isset( WC()->cart ) ) {
     219        foreach ( WC()->cart->cart_contents as $item ) {
     220
     221            if ( 0 === $item['product_id'] ) {
     222                $item['product_id'] = qwc_get_product_id_by_variation_id( $item['variation_id'] );
     223            }
     224            $product_id    = apply_filters( 'qwc_cart_check_item_product_id', $item['product_id'], $item );
     225            $quantity      = isset( $item['quantity'] ) ? $item['quantity'] : 1;
     226            $quote_enabled = product_quote_enabled( $product_id, $quantity );
     227
     228            if ( ! $quote_enabled ) {
     229                $purchasable = true;
     230                break;
     231            }
     232        }
     233    }
     234    return $purchasable;
     235}
     236
     237/**
     238 * Returns whether order contains non-quote (purchase) products or no.
     239 *
     240 * @param object $order - WC_Order.
     241 * @return bool|false - Order contains quot products | false when no data found.
     242 */
     243function order_contains_purchase( $order ) {
     244
     245    $purchasable = false;
     246
     247    if ( $order ) {
     248        foreach ( $order->get_items() as $item ) {
     249            $quantity      = isset( $item['quantity'] ) ? $item['quantity'] : 1;
     250            $product_quote = product_quote_enabled( $item['product_id'], $quantity );
     251            if ( ! $product_quote ) {
     252                $purchasable = true;
     253                break;
     254            }
     255        }
     256    }
     257
     258    return $purchasable;
     259}
  • quotes-for-woocommerce/trunk/languages/quote-wc.pot

    r3153140 r3169811  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Quotes for WooCommerce 2.4\n"
     5"Project-Id-Version: Quotes for WooCommerce 2.5\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/quotes-for-woocommerce\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2024-09-16T16:43:57+02:00\n"
     12"POT-Creation-Date: 2024-10-15T13:10:54+02:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.11.0\n"
     
    4848
    4949#: class-quotes-wc.php:505
    50 #: class-quotes-wc.php:951
     50#: class-quotes-wc.php:955
    5151#: includes/admin/class-quotes-wc-general-settings.php:77
    5252msgid "Proceed to Checkout"
     
    5454
    5555#. translators: Leave price blanks as its not be displayed.
    56 #: class-quotes-wc.php:581
     56#: class-quotes-wc.php:582
    5757msgid "<strong>Subtotal:</strong> <span class='amount'>%s</span>"
    5858msgstr ""
    5959
    60 #: class-quotes-wc.php:619
     60#: class-quotes-wc.php:620
    6161msgid "It is not possible to add products that require quotes to the Cart along with ones that do not. Hence, the existing products have been removed from the Cart."
    6262msgstr ""
    6363
    64 #: class-quotes-wc.php:768
     64#: class-quotes-wc.php:771
    6565msgid "Quote Complete"
    6666msgstr ""
    6767
    68 #: class-quotes-wc.php:772
     68#: class-quotes-wc.php:775
    6969#: includes/emails/class-qwc-send-quote.php:24
    7070msgid "Send Quote"
    7171msgstr ""
    7272
    73 #: class-quotes-wc.php:774
     73#: class-quotes-wc.php:777
    7474msgid "Resend Quote"
    7575msgstr ""
    7676
    77 #: class-quotes-wc.php:803
     77#: class-quotes-wc.php:806
    7878msgid "Quote Complete."
    7979msgstr ""
    8080
    81 #: class-quotes-wc.php:872
     81#: class-quotes-wc.php:875
    8282msgid "Quote email sent to "
    8383msgstr ""
    8484
    85 #: class-quotes-wc.php:890
    86 #: class-quotes-wc.php:916
     85#: class-quotes-wc.php:893
     86#: class-quotes-wc.php:919
    8787#: includes/admin/class-quotes-wc-general-settings.php:75
    8888msgid "Cart"
    8989msgstr ""
    9090
    91 #: class-quotes-wc.php:922
     91#: class-quotes-wc.php:925
    9292#: includes/admin/class-quotes-wc-general-settings.php:76
    9393msgid "Checkout"
    9494msgstr ""
    9595
    96 #: class-quotes-wc.php:1044
    97 #: includes/class-quotes-payment-gateway.php:49
     96#: class-quotes-wc.php:1067
     97#: includes/class-quotes-payment-gateway.php:50
    9898msgid "Settings"
    9999msgstr ""
    100100
    101 #: class-quotes-wc.php:1045
     101#: class-quotes-wc.php:1068
    102102msgid "Get Quotes Pro"
    103103msgstr ""
    104104
    105 #: class-quotes-wc.php:1060
     105#: class-quotes-wc.php:1083
    106106msgid "Quotes menu has moved!"
    107107msgstr ""
    108108
    109 #: class-quotes-wc.php:1061
     109#: class-quotes-wc.php:1084
    110110msgid "The Quotes settings can now be managed from WooCommerce > Settings > Quotes."
    111111msgstr ""
     
    203203msgstr ""
    204204
    205 #: includes/class-quotes-payment-gateway.php:53
     205#: includes/class-quotes-payment-gateway.php:54
    206206msgid "This is a fictitious payment method used for quotes."
    207207msgstr ""
    208208
    209 #: includes/class-quotes-payment-gateway.php:54
     209#: includes/class-quotes-payment-gateway.php:55
    210210msgid "This gateway requires no configuration."
    211211msgstr ""
    212212
    213 #: includes/class-quotes-payment-gateway.php:74
     213#: includes/class-quotes-payment-gateway.php:75
    214214msgid "This order is awaiting quote."
    215215msgstr ""
    216216
    217 #: includes/class-quotes-payment-gateway.php:96
     217#: includes/class-quotes-payment-gateway.php:97
    218218msgid "We have received your request for a quote. You will be notified via email soon."
    219219msgstr ""
     
    402402msgstr ""
    403403
    404 #. translators: Site Name.
    405404#. translators: Customer Name.
    406405#: templates/emails/plain/request-new-quote.php:12
     
    409408msgstr ""
    410409
    411 #. translators: Order payment link.
    412 #. translators: Admin Url for payment.
     410#. translators: Admin Url for order.
    413411#: templates/emails/plain/request-new-quote.php:68
    414412#: templates/emails/request-new-quote.php:79
     
    416414msgstr ""
    417415
    418 #. translators: User first name.
    419416#. translators: Billing First Name.
    420417#: templates/emails/plain/send-quote.php:14
     
    423420msgstr ""
    424421
    425 #. translators: Site name.
    426422#. translators: Site Name.
    427423#: templates/emails/plain/send-quote.php:17
     
    430426msgstr ""
    431427
    432 #. translators: Payment URL.
    433428#. translators: Payment Link Url.
    434429#: templates/emails/plain/send-quote.php:24
  • quotes-for-woocommerce/trunk/quotes-woocommerce.php

    r3153140 r3169811  
    33 * Plugin Name: Quotes for WooCommerce
    44 * Description: This plugin allows you to convert your WooCommerce store into a quote only store. It will hide the prices for the products and not take any payment at Checkout. You can then setup prices for the items in the order and send a notification to the Customer.
    5  * Version: 2.5
     5 * Version: 2.6
    66 * Author: TechnoVama
    77 * Requires at least: 4.5
     
    3030    add_action(
    3131        'admin_notices',
    32         function() {
     32        function () {
    3333            // translators: plugin name with link.
    3434            $msg = sprintf( __( 'Please install and activate %s before activating Quotes for WooCommerce.', 'quote-wc' ), '<a href="https://wordpress.org/plugins/woocommerce/" target="_blank">WooCommerce</a>' );
     
    5151add_action(
    5252    'before_woocommerce_init',
    53     function() {
     53    function () {
    5454        if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
    5555            \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
  • quotes-for-woocommerce/trunk/readme.txt

    r3153140 r3169811  
    55Requires at least: 4.5
    66Tested up to: 6.6.2
    7 Stable tag: 2.5
     7Stable tag: 2.6
    88Requires PHP: 7.2
    99License: GPLv2 or later
     
    3838<ul>
    3939<li>Enable quotes for only some products in the store.</li>
     40<li>Allow quote and purchasable products in a single cart.</li>
    4041<li>Enable quotes for select variations of a product</li>
     42<li>Automatically enable quotes based on item quantity for each product.</li>
    4143<li>Customize quote button display based on WordPress User Roles</li>
    4244<li>Seamlessly process both regular orders and quote requests for all products</li>
     
    8183
    8284== Changelog ==
     85
     86= 2.6 ( 16.10.2024 ) =
     87* Tweak - Added some filters for compatibility with Premium 1.5.
     88* Fix - Address WooCommerce Payment Gateway API required fields.
    8389
    8490= 2.5 ( 17.09.2024 ) =
  • quotes-for-woocommerce/trunk/templates/emails/new-quote-request-sent-customer.php

    r3153140 r3169811  
    4444            <tr>
    4545                <td style="text-align:left; border: 1px solid #eee;">
    46                     <a href='<?php echo esc_url( get_permalink( $product_id ) ); ?>' target='_blank'><?php echo wp_kses_post( $items->get_name() );?></a>
     46                    <a href='<?php echo esc_url( get_permalink( $product_id ) ); ?>' target='_blank'><?php echo wp_kses_post( $items->get_name() ); ?></a>
    4747                    <?php
    4848                    // allow other plugins to add additional product information here.
  • quotes-for-woocommerce/trunk/templates/emails/plain/request-new-quote.php

    r3153140 r3169811  
    99$margin_side = is_rtl() ? 'left' : 'right';
    1010
    11 // translators: Site Name.
     11// translators: Customer Name.
    1212$opening_paragraph = __( 'A request for quote has been made by %s and is awaiting your attention. The details of the order are as follows:', 'quote-wc' );
    1313echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n";
     
    6565    echo "\n----------------------------------------\n\n";
    6666    echo sprintf( esc_html__( 'This order is awaiting a quote.', 'quote-wc' ) );
    67     // translators: Order payment link.
     67    // translators: Admin Url for order.
    6868    echo wp_kses_post( make_clickable( sprintf( __( 'You can view and edit this order in the dashboard here: %s', 'quote-wc' ), $order_url ) ) );
    6969
  • quotes-for-woocommerce/trunk/templates/emails/plain/send-quote.php

    r3110434 r3169811  
    1111if ( $order ) :
    1212    $billing_first_name = ( version_compare( WOOCOMMERCE_VERSION, '3.0.0' ) < 0 ) ? $order->billing_first_name : $order->get_billing_first_name();
    13     // translators: User first name.
     13    // translators: Billing First Name.
    1414    echo sprintf( esc_html__( 'Hello %s', 'quote-wc' ), esc_attr( $billing_first_name ) ) . "\n\n";
    1515endif;
    16 // translators: Site name.
     16// translators: Site Name.
    1717echo sprintf( esc_html__( 'You have received a quotation for your order on %s. The details of the same are shown below.', 'quote-wc' ), esc_attr( $order_details->blogname ) );
    1818
     
    2121    $order_status = $order->get_status();
    2222    if ( 'pending' === $order_status ) :
    23         // translators: Payment URL.
     23        // translators: Payment Link Url.
    2424        echo sprintf( esc_html__( 'To pay for this order please use the following link: %s', 'quote-wc' ), esc_url( $order->get_checkout_payment_url() ) );
    2525    endif;
  • quotes-for-woocommerce/trunk/templates/emails/request-new-quote.php

    r3153140 r3169811  
    7676<p>
    7777    <?php
    78     // translators: Admin Url for payment.
     78    // translators: Admin Url for order.
    7979    echo wp_kses_post( make_clickable( sprintf( __( 'You can view and edit this order in the dashboard here: %s', 'quote-wc' ), esc_url( $order_url ) ) ) );
    8080    ?>
  • quotes-for-woocommerce/trunk/templates/emails/send-quote.php

    r3110434 r3169811  
    5353    }
    5454    ?>
    55     <h2><?php echo esc_html__( 'Order', 'quote-wc' ) . ': ' . esc_html( $order->get_order_number() ); ?> (<?php printf( '<time datetime="%s">%s</time>', wp_kses_post( date_i18n( 'c', strtotime( $order_date ) ) ), wp_kses_post( date_i18n( wc_date_format(), strtotime( $order_date ) ) ) );?>)</h2>
     55    <h2><?php echo esc_html__( 'Order', 'quote-wc' ) . ': ' . esc_html( $order->get_order_number() ); ?> (<?php printf( '<time datetime="%s">%s</time>', wp_kses_post( date_i18n( 'c', strtotime( $order_date ) ) ), wp_kses_post( date_i18n( wc_date_format(), strtotime( $order_date ) ) ) ); ?>)</h2>
    5656    <table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
    5757        <thead>
Note: See TracChangeset for help on using the changeset viewer.