Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter spaghettamine

    (@spaghettamine)

    FYI, the link “Set up and use a child theme” leads to an abandoned page, so the WooCommerce link isn’t really applicable to my situation of not wanting to use plugins. I guess I will mark as resolved and just keep troubleshooting.

    • This reply was modified 10 months, 3 weeks ago by spaghettamine.
    Thread Starter spaghettamine

    (@spaghettamine)

    Thank you for responding.

    I have been making these changes within my theme’s WooCommerce folder (which has worked in the past for PHP changes). To clarify, I am not directly editing the WooCommerce plugin files but uploading an edited CSS file under mytheme/woocommerce (not plugins/woocommerce).

    Am I correct in my understanding that within mytheme/woocommerce, I should not be uploading a modified wc-blocks.css file, but rather putting it in the woocommerce.css file?

    Just to make sure I am being clear: The CSS I wish to edit is located in wc-blocks.css. I am familiar with the practice of uploading custom files into mytheme/woocommerce, but alternative stylesheet I uploaded for wc-blocks.css (mytheme/woocommerce/packages/build/wc-blocks.css) is not being detected, and the site is still using the default stylesheet. I have already tried clearing the cache and I do not believe it is a caching issue.

    I have implemented a temporary solution using the WordPress customize.php feature, but I would like to figure out the best practice here and avoid excessive plugins if there are better solutions within the built-in functionality of overwriting default WooCommerce styles.

    Thank you again for your help.

    Edit: I am still investigating this and noticed that this styling is also present in elements.scss. (I am specifically trying to modify .woocommerce-success.)

    • This reply was modified 10 months, 3 weeks ago by spaghettamine.
    Thread Starter spaghettamine

    (@spaghettamine)

    I am 99% sure my site is not using WooCommerce Square. The Express Checkout option on my site is enabled through WooPayments.

    For what it’s worth, this is the code I ended up using:

    //Disable express pay for payment plans
    add_action('wp_footer', 'hide_express_pay_for_specific_product');
    
    function hide_express_pay_for_specific_product() {
        $product_id_to_hide = // PRODUCT ID GOES HERE;
    
        if ((is_product() && get_the_ID() == $product_id_to_hide) || (is_cart() && is_product_in_cart($product_id_to_hide)) || (is_checkout() && is_product_in_cart($product_id_to_hide))) {
            ?>
            <style>
                .wcpay-payment-request-wrapper {
                    display: none !important;
                }
            </style>
            <?php
        }
    }
    
    // Function to check if a specific product is in the cart
    function is_product_in_cart($product_id) {
        foreach (WC()->cart->get_cart() as $cart_item_key => $cart_item) {
            if ($cart_item['product_id'] === $product_id) {
                return true;
            }
        }
        return false;
    }
Viewing 3 replies - 1 through 3 (of 3 total)