Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Bid Pricing #98

Merged
merged 9 commits into from
Dec 19, 2023
Merged

Dynamic Bid Pricing #98

merged 9 commits into from
Dec 19, 2023

Conversation

bd-viget
Copy link
Contributor

Summary

This PR implements the Bid auto-increment feature when a bid is successfully placed on an Auction, the Bid Product price will increment by the Bid Increment amount, ready for the next bid.

It also includes a Meta Box on the Order Detail page that shows the Related Auction and Reward Product details.

Issues

Testing Instructions

  1. Create a Reward Product (if you have not already done so)
  2. Set up WooCommerce Stripe (if you have not already done so)
  3. Create a new Auction - Even if you already have an existing auction.
  4. Visit the Auction (you should see a Bid Now button)
  5. Click the Bid Now button
  6. Complete the checkout
  7. You should be redirected back to the Auction
  8. The Bid Now should be updated with the new Bid amount
  9. Clicking "Bid Now" should add the Bid to your cart with the correct, updated Bid Amount

Screenshots

Order Auction Info Meta Box
Screenshot 2023-12-18 at 11 37 24 AM

@clatwell
Copy link
Contributor

Holy cannoli this is so cool 😍

*/
public function get_product_type( int $product_id ): ?string {
$valid = [ 'bids', 'rewards' ];
$categories = get_the_terms( $product_id, 'product_cat' );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any value of using a PHP const for product_cat? Or is that something that will always stay the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, product_cat is defined by WooCommerce, and they do not use a constant. I'm not sure how much benefit it will have to define our own, but I think it's pretty safe to say it will never change.

Copy link
Contributor

@nathan-schmidt-viget nathan-schmidt-viget left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works and update the bid amount. The only thing I kept getting was this error. But it still completed the order just never took me to the order completed view. Could be how I set up Stripe. I used [GB] Nonprofit Test Stripe Account and added the test keys in the plugin.

Screenshot 2023-12-18 at 5 26 33 PM

<a href="<?php echo esc_url( $button_url ); ?>" class="wp-block-button__link wp-element-button">
<?php esc_html_e( 'Bid Now', 'goodbids' ); ?>
<a href="<?php echo esc_url( $bid_now->get_button_url() ); ?>" class="wp-block-button__link wp-element-button">
<?php echo wp_kses_post( $bid_now->get_button_text() ); ?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cool!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran into the checkout error when I was working on #65 and believe I have it fixed in that branch. Good catch!

@bd-viget bd-viget mentioned this pull request Dec 19, 2023
@bd-viget bd-viget merged commit bb6d1f3 into main Dec 19, 2023
1 check passed
@bd-viget bd-viget deleted the bd/25-dynamic-bid-pricing branch December 19, 2023 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants