woocommerce_pay_order_product_in_stock

woocommerce_pay_order_product_in_stock

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.9.8.1

apply_filters('woocommerce_pay_order_product_in_stock') is found 2 times:

  • /includes/shortcodes/class-wc-shortcode-checkout.php line 154
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    if ( ! $product ) {
        continue;
    }
     
    if ( ! apply_filters( 'woocommerce_pay_order_product_in_stock', $product->is_in_stock(), $product, $order ) ) {
        /* translators: %s: product name */
        throw new Exception( sprintf( __( 'Sorry, "%s" is no longer in stock so this order cannot be paid for. We apologize for any inconvenience caused.', 'woocommerce' ), $product->get_name() ) );
    }
     
    // We only need to check products managing stock, with a limited stock qty.
    if ( ! $product->managing_stock() || $product->backorders_allowed()  ) {
  • /src/StoreApi/Utilities/OrderController.php line 639
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    * @param \WC_Order $order Order.
     *
     * @since 9.8.0-dev
     */
    if ( ! apply_filters( 'woocommerce_pay_order_product_in_stock', $product->is_in_stock(), $product, $order ) ) {
        return array(
            'code'    => 'woocommerce_rest_out_of_stock',
            /* translators: %s: product name */
            'message' => sprintf( __( 'Sorry, "%s" is no longer in stock so this order cannot be paid for. We apologize for any inconvenience caused.', 'woocommerce' ), $product->get_name() ),
        );
    }