Forum Replies Created

Viewing 15 replies - 16 through 30 (of 42 total)
  • Thread Starter PossiblyMaybe

    (@possiblymaybe)

    Thanks Kyle! I suppose it isnt an issue with logged in customers, but what prevents spam orders if you have guest checkout enabled? I will checkout those links you sent!

    Thread Starter PossiblyMaybe

    (@possiblymaybe)

    Found the answer with help on Stackoverflow website. Put it here if it might help someone else:

    
    // Add columns to admin orders table.
    add_filter( 'manage_edit-shop_order_columns', 'set_custom_edit_shop_order_columns' );
    function set_custom_edit_shop_order_columns($columns) {
        $columns['courier_reference'] = __( 'Courier reference', 'woocommerce' );
        $columns['tracking_number'] = __( 'Tracking number', 'woocommerce' );
        $columns['shipping_date'] = __( 'Shipping date', 'woocommerce' );
        return $columns;
    }
    
    // Add the data to the custom columns for the order post type:
    add_action( 'manage_shop_order_posts_custom_column' , 'custom_shop_order_column', 10, 2 );
    function custom_shop_order_column( $column, $post_id ) {
        switch ( $column ) {
    
            case 'courier_reference' :
                echo esc_html( get_post_meta( $post_id, 'courier_reference', true ) );
                break;
    
            case 'tracking_number' :
                echo esc_html( get_post_meta( $post_id, 'tracking_number', true ) );
                break;
    
            case 'shipping_date' :
                echo esc_html( get_post_meta( $post_id, 'shipping_date', true ) );
                break;
    
        }
    }
    
    // Add a metabox.
    add_action( 'add_meta_boxes', 'add_shop_order_meta_box' );
    function add_shop_order_meta_box() {
    
        add_meta_box(
            'custom_meta_box',
            __( 'Tracking information', 'woocommerce' ),
            'shop_order_content_callback',
            'shop_order'
        );
    
    }
    
    // For displaying metabox content
    function shop_order_content_callback( $post ) {
    
        $courier_reference = get_post_meta( $post->ID, 'courier_reference', true );
    
        echo '<p>' . __( 'Courier reference', 'woocommerce' ) . '<br>
        <textarea style="width:100%" id="courier_reference" name="courier_reference">' . esc_attr( $courier_reference ) . '</textarea></p>';
    
        $tracking_number = get_post_meta( $post->ID, 'tracking_number', true );
    
        echo '<p>' . __( 'Tracking number', 'woocommerce' ) . '<br>
        <input type="text" style="width:100%" id="tracking_number" name="tracking_number" value="' . esc_attr( $tracking_number ) . '"></p>';
    
        $shipping_date = get_post_meta( $post->ID, 'shipping_date', true );
    
        echo '<p>' . __( 'shipping_date', 'woocommerce' ) . '<br>
        <input type="text" style="width:100%" id="shipping_date" name="shipping_date" value="' . esc_attr( $shipping_date ) . '"></p>';
    }
    
    // For saving the metabox data.
    add_action( 'save_post_shop_order', 'save_shop_order_meta_box_data' );
    function save_shop_order_meta_box_data( $post_id ) {
    
        // If this is an autosave, our form has not been submitted, so we don't want to do anything.
        if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
            return;
        }
    
        // Check the user's permissions.
        if ( ! current_user_can( 'edit_shop_order', $post_id ) ) {
            return;
        }
    
        // Make sure that 'shipping_date' is set.
        if ( isset( $_POST['courier_reference'] ) ) {
    
            // Update the meta field in the database.
            update_post_meta( $post_id, 'courier_reference', sanitize_textarea_field( $_POST['courier_reference'] ) );
        }
    
        // Make sure that 'tracking_number' it is set.
        if ( isset( $_POST['tracking_number'] ) ) {
    
            // Update the meta field in the database.
            update_post_meta( $post_id, 'tracking_number', sanitize_text_field( $_POST['tracking_number'] ) );
        }
    
        // Make sure that 'shipping_date' is set.
        if ( isset( $_POST['shipping_date'] ) ) {
    
            // Update the meta field in the database.
            update_post_meta( $post_id, 'shipping_date', sanitize_text_field( $_POST['shipping_date'] ) );
        }
    }
    

    I’d like to make the last Shipping Date field a date picker input, if anyone can help with that?

    Thread Starter PossiblyMaybe

    (@possiblymaybe)

    Hi there, thanks for the comment.

    I am using that plugin already for my first snippet. If I try use the snippet again I get the error “Cannot redeclare function set_custom_edit_shop_order_columns.” Also because the code above uses custom_column, and that is what I am using with Admin Columns to pull in the value to display in my Order Admin page, I cant use that a second time either.

    Thread Starter PossiblyMaybe

    (@possiblymaybe)

    Murphy’s Law – just as you have helped me to do this, and I show it to the client (my boss), she comes up with two more fields she wants there now. How do I add another two fields to this bit of code Thanks!

    Thread Starter PossiblyMaybe

    (@possiblymaybe)

    This is awesome, thanks so much!!

    I’m using a plugin called Admin Columns and have now added a column to my Orders Admin page which is pulling in the custom_column text. Perfect!

    In your code above can I change all the instances of ‘custom_column’ to ‘courier_reference’ just to make the code clearer to anyone who might be maintaining the site in future?

    Thread Starter PossiblyMaybe

    (@possiblymaybe)

    Also, I just tested the email invoice, and clicked on the ‘Pay for this Order’ link which takes me to my site but the Checkout form doesnt display. Is this an issue with Woocommerce, my payment gateway, or my theme?

    Thank you!

    Thread Starter PossiblyMaybe

    (@possiblymaybe)

    Hi Ashish, thanks so much for the quick reply.

    I am moving to Woo from a platform that does allow this and so I have some getting used to a new way of working!

    We occasionally get customers who phone to ask to add something to their order. In this case I understand that we can add a product in wp-admin and email them the invoice. Is it also possible to add a way for customers to do this themselves through the site, for example through My Account if an order is still in Processing?

    Thread Starter PossiblyMaybe

    (@possiblymaybe)

    Hi Robin, thanks for replying. I do indeed have yoast installed (although i’m leaving it to last to set it up properly). I will look in to this, thanks again!

    Thread Starter PossiblyMaybe

    (@possiblymaybe)

    Well that was easy, first one I checked, it was Yoasts ‘Local’ Add-on. I’ve not gotten round to setting it up yet, so not sure why it adds this functionality, yet!

    Thread Starter PossiblyMaybe

    (@possiblymaybe)

    Hi there,

    No I’ve not added any code for that. I also noticed there is a Transport menu item in the Woocommerce menu on the Dashboard, but there dont seem to be any settings in it. Very strange! I think I will have to start turning on and off plugins, which is a pain for the one or two that dont hold their settings!

    Thanks again for looking!

    Thread Starter PossiblyMaybe

    (@possiblymaybe)

    Hi thanks for the quick reply. Please the status below:

    
    ### WordPress Environment ###
    
    WordPress address (URL): https://ehops.clarkitservices.co.uk
    Site address (URL): https://ehops.clarkitservices.co.uk
    WC Version: 4.0.1
    REST API Version: ? 1.0.7
    WC Blocks Version: ? 2.5.14
    Action Scheduler Version: ? 3.1.4
    WC Admin Version: ? 1.0.3
    Log Directory Writable: ?
    WP Version: 5.4
    WP Multisite: –
    WP Memory Limit: 256 MB
    WP Debug Mode: –
    WP Cron: ?
    Language: en_GB
    External object cache: –
    
    ### Server Environment ###
    
    Server Info: Apache/2.4.6
    PHP Version: 7.0.10 - We recommend using PHP version 7.2 or above for greater performance and security. How to update your PHP version
    PHP Post Max Size: 8 MB
    PHP Time Limit: 40
    PHP Max Input Vars: 1000
    cURL Version: 7.29.0
    NSS/3.28.4
    
    SUHOSIN Installed: –
    MySQL Version: 5.5.64-MariaDB
    Max Upload Size: 8 MB
    Default Timezone is UTC: ?
    fsockopen/cURL: ?
    SoapClient: ? Your server does not have the SoapClient class enabled - some gateway plugins which use SOAP may not work as expected.
    DOMDocument: ?
    GZip: ?
    Multibyte String: ?
    Remote Post: ?
    Remote Get: ?
    
    ### Database ###
    
    WC Database Version: 4.0.1
    WC Database Prefix: wp_
    Total Database Size: 36.27MB
    Database Data Size: 28.02MB
    Database Index Size: 8.25MB
    wp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_order_itemmeta: Data: 0.16MB + Index: 0.13MB + Engine InnoDB
    wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_actionscheduler_actions: Data: 1.47MB + Index: 0.41MB + Engine InnoDB
    wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_actionscheduler_logs: Data: 0.23MB + Index: 0.19MB + Engine InnoDB
    wp_admin_columns: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_automatewoo_abandoned_carts: Data: 0.03MB + Index: 0.08MB + Engine InnoDB
    wp_automatewoo_customers: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
    wp_automatewoo_customer_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_automatewoo_events: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_automatewoo_guests: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_automatewoo_guest_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_automatewoo_logs: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_automatewoo_log_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_automatewoo_queue: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_automatewoo_queue_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_automatewoo_unsubscribes: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_cartflows_ca_cart_abandonment: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_cartflows_ca_email_history: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_cartflows_ca_email_templates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_cartflows_ca_email_templates_meta: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_cart_notices: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_comments: Data: 0.06MB + Index: 0.09MB + Engine InnoDB
    wp_email_log: Data: 1.52MB + Index: 0.00MB + Engine InnoDB
    wp_grp_google_place: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_grp_google_review: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_login_redirects: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_mailchimp_carts: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_mailchimp_jobs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_mec_dates: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_mec_events: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_ms_snippets: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_options: Data: 5.47MB + Index: 0.23MB + Engine InnoDB
    wp_postmeta: Data: 8.52MB + Index: 4.02MB + Engine InnoDB
    wp_posts: Data: 7.52MB + Index: 0.59MB + Engine InnoDB
    wp_revslider_css: Data: 0.14MB + Index: 0.00MB + Engine InnoDB
    wp_revslider_css_bkp: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_revslider_layer_animations: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_revslider_layer_animations_bkp: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_revslider_navigations: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_revslider_navigations_bkp: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_revslider_sliders: Data: 0.08MB + Index: 0.00MB + Engine InnoDB
    wp_revslider_sliders_bkp: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_revslider_slides: Data: 0.13MB + Index: 0.00MB + Engine InnoDB
    wp_revslider_slides_bkp: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_revslider_static_slides: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_revslider_static_slides_bkp: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_sbi_instagram_feeds_posts: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_sbi_instagram_posts: Data: 0.27MB + Index: 0.00MB + Engine InnoDB
    wp_snippets: Data: 0.06MB + Index: 0.00MB + Engine InnoDB
    wp_termmeta: Data: 0.05MB + Index: 0.03MB + Engine InnoDB
    wp_terms: Data: 0.14MB + Index: 0.16MB + Engine InnoDB
    wp_term_relationships: Data: 0.23MB + Index: 0.13MB + Engine InnoDB
    wp_term_taxonomy: Data: 0.13MB + Index: 0.16MB + Engine InnoDB
    wp_usermeta: Data: 0.17MB + Index: 0.03MB + Engine InnoDB
    wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_wc_admin_notes: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_product_meta_lookup: Data: 0.06MB + Index: 0.09MB + Engine InnoDB
    wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wdp_orders: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_wdp_order_items: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_wdp_rules: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_bundled_itemmeta: Data: 0.13MB + Index: 0.14MB + Engine InnoDB
    wp_woocommerce_bundled_items: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_shipping_quotes: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_woocommerce_shipping_table_rates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wpfb_gettwitter_forms: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_yoast_seo_links: Data: 0.05MB + Index: 0.02MB + Engine InnoDB
    wp_yoast_seo_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    
    ### Post Type Counts ###
    
    attachment: 2198
    br_notice: 1
    custom_css: 1
    customize_changeset: 2
    mc4wp-form: 1
    mec_calendars: 13
    mec-books: 2
    mec-events: 8
    nav_menu_item: 143
    page: 26
    post: 16
    product: 361
    product_variation: 1
    revision: 797
    shop_coupon: 1
    shop_order: 30
    shortcoder: 7
    vc_grid_item: 1
    woo_discount: 2
    woo_discount_cart: 2
    wpcf7_contact_form: 7
    
    ### Security ###
    
    Secure connection (HTTPS): ?
    Hide errors from visitors: ?
    
    ### Active Plugins (43) ###
    
    The7 Ultimate Addons for WPBakery Page Builder: by Brainstorm Force – 3.19.4
    Admin Columns Pro - WooCommerce: by AdminColumns.com – 3.4.1 – Not tested with the active version of WooCommerce
    Admin Columns Pro: by AdminColumns.com – 5.1.4
    AutomateWoo: by WooCommerce – 4.7.4 – Not tested with the active version of WooCommerce
    Booster Plus for WooCommerce: by Algoritmika Ltd – 4.8.0
    Classic Editor: by WordPress Contributors – 1.5
    Code Snippets: by Code Snippets Pro – 2.14.0
    Coming Soon Page & Maintenance Mode by SeedProd: by SeedProd – 5.1.0
    Contact Form 7: by Takayuki Miyoshi – 5.1.7
    Display Image Dimensions in Media Library: by Mike iLL/mZoo – 1.0.3
    Email Log: by Sudar – 2.3.2
    Social Reviews & Recommendations: by RichPlugins  – 1.6.9
    Instagram Feed Pro Personal: by Smash Balloon – 5.4.1
    The7 WPBakery Page Builder: by Michael M - WPBakery.com – 6.1
    MC4WP: Mailchimp for WordPress: by ibericode – 4.7.6
    Peter's Login Redirect: by Peter Keung – 2.9.7
    Barclay Card - ePDQ payment gateway for WooCommerce: by Pluginsmaker – 2.1 – Not tested with the active version of WooCommerce
    Really Simple CAPTCHA: by Takayuki Miyoshi – 2.0.2
    The7 Slider Revolution: by ThemePunch – 6.2.2
    Shortcoder: by Aakash Chakravarthy – 5.3
    UpdraftPlus - Backup/Restore: by UpdraftPlus.Com
    DavidAnderson – 2.16.23.24
    
    User Notes: by Cartpauj – 1.0.1
    User Role Editor: by Vladimir Garagulya – 4.53.1
    Google Reviews Widget: by RichPlugins  – 1.8.6
    Checkout Field Editor for WooCommerce: by ThemeHigh – 1.4.2
    Woo Discount Rules: by Flycart Technologies LLP – 1.9.6
    Advanced Order Export For WooCommerce: by AlgolPlus – 3.1.4
    WooCommerce Admin: by WooCommerce – 1.0.3
    WooCommerce Cart Notices: by SkyVerge – 1.11.0 – Not tested with the active version of WooCommerce
    WooCommerce Composite Products: by SomewhereWarm – 5.0.2 – Not tested with the active version of WooCommerce
    WooCommerce Conditional Shipping and Payments: by SomewhereWarm – 1.7.5
    WooCommerce Google Analytics Integration: by WooCommerce – 1.4.20
    WooCommerce Print Invoices/Packing Lists: by SkyVerge – 3.7.1 – Not tested with the active version of WooCommerce
    WooCommerce Product Bundles: by SomewhereWarm – 5.13.2 – Not tested with the active version of WooCommerce
    WooCommerce Protected Categories: by Barn2 Plugins – 2.4
    WooCommerce Sequential Order Numbers Pro: by SkyVerge – 1.15.0 – Not tested with the active version of WooCommerce
    WooCommerce Smart Coupons: by StoreApps – 4.5.1 – Not tested with the active version of WooCommerce
    WooCommerce Table Rate Shipping: by WooCommerce – 3.0.20 – Not tested with the active version of WooCommerce
    WooCommerce: by Automattic – 4.0.1
    Yoast SEO Premium: by Team Yoast – 13.4.1
    Yoast SEO: Local: by Team Yoast and Arjan Snaterse – 12.7
    Yoast SEO: WooCommerce: by Team Yoast – 12.6.2
    Custom Product Tabs for WooCommerce: by YIKES
    Inc. – 1.7.1
    
    ### Inactive Plugins (13) ###
    
    Advanced Dynamic Pricing for WooCommerce: by AlgolPlus – 2.3.3
    Akismet Anti-Spam: by Automattic – 4.1.4
    Kadence WooCommerce Email Designer: by Kadence WP – 1.4.1
    Mailchimp for WooCommerce: by Mailchimp – 2.3.6
    Media Library Assistant: by David Lingren – 2.83
    Order Minimum/Maximum Amount for WooCommerce: by Algoritmika Ltd – 2.2.0
    W3 Total Cache: by BoldGrid – 0.13.2
    Wholesale For WooCommerce: by wpexpertsio – 1.1.1 – Not tested with the active version of WooCommerce
    WooCommerce Cart Abandonment Recovery: by CartFlows Inc – 1.2.5
    WooCommerce Contact for Shipping Quote: by Jeroen Sormani – 1.1.0 – Not tested with the active version of WooCommerce
    WooCommerce Instagram: by WooCommerce – 3.0.0 – Not tested with the active version of WooCommerce
    WooCommerce WP-Login: by MachineITSvcs <[email protected]> – 1.1.8 – Not tested with the active version of WooCommerce
    Wordfence Security: by Wordfence – 7.4.6
    
    ### Settings ###
    
    API Enabled: –
    Force SSL: –
    Currency: GBP (£)
    Currency Position: left
    Thousand Separator: ,
    Decimal Separator: .
    Number of Decimals: 2
    Taxonomies: Product Types: bundle (bundle)
    composite (composite)
    external (external)
    grouped (grouped)
    simple (simple)
    variable (variable)
    
    Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
    exclude-from-search (exclude-from-search)
    featured (featured)
    outofstock (outofstock)
    rated-1 (rated-1)
    rated-2 (rated-2)
    rated-3 (rated-3)
    rated-4 (rated-4)
    rated-5 (rated-5)
    
    Connected to WooCommerce.com: –
    
    ### WC Pages ###
    
    Shop base: #27 - /essentially-hops-shop/
    Basket: #1779 - /basket/
    Checkout: #1780 - /checkout/
    My account: #1781 - /my-account/
    Terms and conditions: #2094 - /terms-and-conditions/
    
    ### Theme ###
    
    Name: the7dtchild
    Version: 1.0.0
    Author URL: https://dream-theme.com/
    Child Theme: ?
    Parent Theme Name: The7
    Parent Theme Version: 8.6.0
    Parent Theme Author URL: https://dream-theme.com/
    WooCommerce Support: ?
    
    ### Templates ###
    
    Overrides: dt-the7/woocommerce/cart/cart.php
    dt-the7/woocommerce/cart/cross-sells.php
    dt-the7/woocommerce/checkout/form-billing.php
    dt-the7/woocommerce/checkout/form-checkout.php
    dt-the7/woocommerce/checkout/form-coupon.php
    dt-the7/woocommerce/checkout/form-login.php
    dt-the7/woocommerce/checkout/form-shipping.php
    dt-the7/woocommerce/checkout/review-order.php
    dt-the7/woocommerce/checkout/thankyou.php
    dt-the7/woocommerce/content-product.php
    dt-the7/woocommerce/content-product_cat.php
    dt-the7/woocommerce/global/breadcrumb.php
    dt-the7/woocommerce/global/form-login.php
    dt-the7/woocommerce/global/quantity-input.php
    dt-the7/woocommerce/loop/loop-end.php
    dt-the7/woocommerce/loop/loop-start.php
    dt-the7/woocommerce/loop/pagination.php
    dt-the7/woocommerce/myaccount/form-login.php
    dt-the7/woocommerce/notices/error.php
    dt-the7/woocommerce/notices/notice.php
    dt-the7/woocommerce/notices/success.php
    dt-the7/woocommerce/order/order-details-customer.php
    dt-the7/woocommerce/order/order-details.php
    dt-the7/woocommerce/single-product/meta.php
    dt-the7/woocommerce/single-product/price.php
    dt-the7/woocommerce/single-product/related.php
    dt-the7/woocommerce/single-product/up-sells.php
    
    ### Composite Products ###
    
    Database Version: 5.0.2
    Template Overrides: –
    
    ### Product Bundles ###
    
    Database Version: 5.13.2
    Template Overrides: –
    
    ### Action Scheduler ###
    
    Complete: 925
    Oldest: 2020-03-17 07:18:41 +0000
    Newest: 2020-04-16 18:57:37 +0100
    
    Pending: 2
    Oldest: 2020-04-16 19:57:37 +0100
    Newest: 2020-04-16 19:57:37 +0100
    
    
    Thread Starter PossiblyMaybe

    (@possiblymaybe)

    Wow thanks so much, a quicker and better reply than I expected!

    So glad you have code ready for Sage 50 as I might have another question or two as I try to set this up.

    Another one is the Sage field ‘Type’ with either SI or SC (Sale Invoice or Sales Credit (refund)), is there a way to output these?

    Thanks!

    Try the following (it worked pretty well for me, but you cant inline edit). I now got Admin Columns plugin instead, which works well to do this and allows editing and can do all the admin tables.

    
    function add_product_column( $columns ) {
        //add column
        $columns['new_column'] = __( 'New column', 'woocommerce' );
    
        return $columns;
    }
    add_filter( 'manage_edit-product_columns', 'add_product_column', 10, 1 );
    
    function add_product_column_content( $column, $postid ) {
        if ( $column == 'new_column' ) {
    
            // output variable
            $output = '';
    
            // Get product object
            $product = wc_get_product( $postid );
    
            // Get Product Variations - WC_Product_Attribute Object
            $product_attributes = $product->get_attributes();
    
            // Not empty, contains values
            if ( !empty( $product_attributes ) ) {
    
                foreach ( $product_attributes as $product_attribute ) {
                    // Get name
                    $attribute_name = str_replace( 'pa_', '', $product_attribute->get_name() );
    
                    // Concatenate
                    $output = $attribute_name . ' = ';
    
                    // Get options
                    $attribute_options = $product_attribute->get_options();
    
                    // Not empty, contains values
                    if ( !empty( $attribute_options ) ) {
    
                        foreach ($attribute_options as $key => $attribute_option ) {
                            // WP_Term Object
                            $term = get_term($attribute_option); // <-- your term ID
    
                            // Not empty, contains values
                            if ( !empty( $term ) ) {
                                $term_name = $term->name;
    
                                // Not empty
                                if ( $term_name != '' ) {
    
                                    // Last loop
                                    end($attribute_options);
                                    if ( $key === key($attribute_options) ) {
                                        // Concatenate
                                        $output .= $term_name;                                  
                                    } else {
                                        // Concatenate
                                        $output .= $term_name . ', ';
                                    }
                                }
                            }
                        }
                    }
    
                    echo $output . '<br>';
                }
            }
        }
    }
    add_action( 'manage_product_posts_custom_column', 'add_product_column_content', 10, 2 );
    
    Thread Starter PossiblyMaybe

    (@possiblymaybe)

    I think I have found the answer! I had everything right in the Tax settings, but clicking the box in general settings to have Default Customer Location at my shop base has stopped the prices displaying without tax when I have the tax setting set to Customer Shipping Address.

    Thanks again Kelly!

    Thread Starter PossiblyMaybe

    (@possiblymaybe)

    Hi Kelly,

    Thanks for such a thoughtful answer! I think your last picture shows me that when you select Jersey or Guernsey it doesnt add tax but when you select the UK it adds tax. And I can see in your settings that you enter the prices excluding tax. So I assume in your shop all prices show excluding tax? If I select ship by customer address then it changes all my shop prices to remove the tax and then adds them at the end, which would be quite odd for a UK customer.

    So this is working a bit differently to what I have in mind I think – I want all prices to display showing tax, and to remove the tax if they select Jersey or Guernsey. We only have customers from these locations once in a blue moon so if it isnt possible to get it right it isnt a disaster. But I’m surprised I cant get it to do it in Woo.

    Thanks again!

Viewing 15 replies - 16 through 30 (of 42 total)