Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)
  • Forum: Fixing WordPress
    In reply to: WordPress sessions
    Thread Starter philipatnedi

    (@philipatnedi)

    Yes I’ve found a few solutions to where a single product is set up as a generic product and then when it gets added to cart the price/name/other product details are overridden with other values set via hidden fields.

    I’d like to learn more about how WooCommerce handles it’s cart via session and cookies but I’m having no luck finding any examples or use cases to build off of.

    At this point I just want to find a solution, so I’m going to try to set up a generic product and override the values.

    Forum: Fixing WordPress
    In reply to: WordPress sessions
    Thread Starter philipatnedi

    (@philipatnedi)

    That sounds great, I’m looking for examples or use cases that can help me set up a cart/checkout that is similar to what WooCommerce is currently doing. We don’t want to use WooCommerce as we are pulling in the products via a third party API call and they aren’t stored on the WordPress site-side of things.

    I wonder if it’s possible to get WooCommerce up and running without products and use meta fields to override the product details. That way we wouldn’t have to rebuild the cart/checkout from scratch?

    Forum: Fixing WordPress
    In reply to: WordPress sessions
    Thread Starter philipatnedi

    (@philipatnedi)

    I think the best route would be to use some sort of session variables, but from what I’ve read I shouldn’t use PHP session states directly and instead try to leverage WordPress. My issue is that I haven’t found any examples or use cases that can get me started. I’m basically trying to replicate WooCommerce’s cart and checkout except there won’t be payment processing.

    Thread Starter philipatnedi

    (@philipatnedi)

    I found the following function in class-wwp-wholesale-prices.php:

    public static function get_product_raw_wholesale_price($product_id, $user_wholesale_role)

    Which should work in my case as I’d have the product id, (variation), and can simply use the one wholesale user role we set up. I can also test the customer assigned to the order to see if they have the wholesale user role. What I’m not sure of is if I can use this within functions.php without any additional setup. I’ll have to test it out and see if it works for me.

    Thread Starter philipatnedi

    (@philipatnedi)

    Hey there, Andrew!

    Thanks for responding back! We are actually using Autoship Cloud, (https://autoship.cloud/), to handle the subscriptions.

    My first question is just about how base WooCommerce processes orders – if it saves the SKUs with the order or if it just retrieves it based on product. I can’t find any meta or any other field to indicate that the SKU is actually saved with the order.

    My second question is if there’s a way in WooCommerce to override/change this SKU on order and not actually change the SKU for the product.

    Thread Starter philipatnedi

    (@philipatnedi)

    With Edit Posts selected under Editing Capabilities this adds the WordPress admin bar up top for the customers. This seems required to be able to delete. I’ve hidden the admin bar for non-admins with:

    if (!current_user_can('manage_options')) {
    	add_filter('show_admin_bar', '__return_false');
    }

    This doesn’t prevent savvy customers from accessing the dashboard on the WordPress back-end by simply typing in /wp-admin though.

    Thread Starter philipatnedi

    (@philipatnedi)

    I’ve updated to the latest version of the plugin and can now see the new options you mentioned on the side of the Capabilities that would allow “Ensure permissions can be controlled separately from other post types.” I’ve selected my custom post type to be able to be controlled this way.

    Playing around with capabilities I eventually got this to work by having Edit and Edit Published options selected for Posts and my Custom Post Type under Editing Capabilities. Then under Deletion Capabilities having both Delete and Delete Published for Posts and my Custom Post Type.

    I’m not sure why I need Edit Capabilities enabled to be able to delete but it works for me now.

    Thread Starter philipatnedi

    (@philipatnedi)

    When I view the capabilities for customer users under Users > Capabilities I can see that the customer role has delete posts and delete published posts under the Deletion Capabilities. I’m not sure if this covers my custom post type, but I did select Post instead of Page in CPT UI to set up the post type.

    Thread Starter philipatnedi

    (@philipatnedi)

    That’s okay, I didn’t really know where to start with it either. I thought it might be because of the custom post type – but I’m not sure. Do you have any suggestions on where I might be able to get an answer to this?

    Thread Starter philipatnedi

    (@philipatnedi)

    I’ve verified the user id as the author and custom post id from within the Admin area on the back-end of the site. The customer user is the author and it has the correct custom post id needed to identify the post to delete.

    It correctly identifies that the customer user can delete the custom post based off of it’s id to display the delete link.

    Thread Starter philipatnedi

    (@philipatnedi)

    When I’m logged into an admin account I can delete a custom post without any issue. When I attempt to delete a custom post with the customer account, the same user assigned as the author, it won’t delete the custom post.

    The dialog works just fine in either case stopping to ask me to confirm the deletion beforehand. However it only actually deletes if I’m logged in as an admin user.

Viewing 11 replies - 1 through 11 (of 11 total)